![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello,
I have written a code using vba and CDO object which works but I also would like to save a copy of the e-mail sent in the "Sent Items" folder in outlook. So, I have looked into MSDN and found the answer objMessage.Send( [saveCopy] [, showDialog] [, parentWindow] ) but it dose not work. I get an error ("wrong number of arguments or invalid property assignment")every time I run my add-in in outlook. How can I make this work ? Here's my code : Public Sub sendFaxViaEmail(listOfAttachements as Collection) Const cdoSendUsingPort = 2 Const cdoBasic = 1 Dim objCDOConfig As Object, objCDOMessage As Object Dim strSch As String strSch = "http://schemas.microsoft.com/cdo/configuration/" Set objCDOConfig = CreateObject("CDO.Configuration") With objCDOConfig.Fields .Item(strSch & "sendusing") = cdoSendUsingPort .Item(strSch & "smtpserver") = "mail.privagest.ch" ' Only used if SMTP server requires Authentication '.Item(strSch & "smtpauthenticate") = cdoBasic '.Item(strSch & "sendusername") = " '.Item(strSch & "sendpassword") = "YourPassword" .Update End With Set objCDOMessage = CreateObject("CDO.Message") With objCDOMessage Set .Configuration = objCDOConfig .From = "Name_From" .Sender = " .To = " '.Categories = "Privafax" '.Subject = "" '.Cc = "" ' Use TextBody to send Email in Plain Text Format .TextBody = "::C=none,H,p=high" ' Use HTMLBody to send Email in Rich Text (HTML) Format '.HTMLBody = "Test CDO Rich Text this is not Bold But BThis is!/B" ' Un-Rem next line to get "Return Reciept Request" '.MDNRequested = True End With If listOfAttachements.Count 0 Then intCounter = 1 While intCounter listOfAttachements.Count + 1 objCDOMessage.AddAttachment listOfAttachements.Item(intCounter) intCounter = intCounter + 1 Wend End If objCDOMessage.Send True '---------------- THE PROBLEM IS HERE ! MsgBox "Fax sent via e-mail.", vbInformation, "Privafax" Set objCDOMessage = Nothing Set objCDOConfig = Nothing End Sub |
Ads |
#2
|
|||
|
|||
![]()
You're mixing up two different CDO libraries. It's not your fault. Microsoft caused a lot of confusion when they gave CDO for Windows (what you're using) and CDO 1.21 (what has the saveCopy parameter) the same name. The Send method in CDO for Windows has no saveCopy parameter; see http://msdn.microsoft.com/library/en...af948785cb.asp
Bottom line is that, since you're sending directly through an SMTP server and not through Outlook, you can't save it in Outlook's Sent Items folder. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Hello, I have written a code using vba and CDO object which works but I also would like to save a copy of the e-mail sent in the "Sent Items" folder in outlook. So, I have looked into MSDN and found the answer objMessage.Send( [saveCopy] [, showDialog] [, parentWindow] ) but it dose not work. I get an error ("wrong number of arguments or invalid property assignment")every time I run my add-in in outlook. How can I make this work ? Here's my code : Public Sub sendFaxViaEmail(listOfAttachements as Collection) Const cdoSendUsingPort = 2 Const cdoBasic = 1 Dim objCDOConfig As Object, objCDOMessage As Object Dim strSch As String strSch = "http://schemas.microsoft.com/cdo/configuration/" Set objCDOConfig = CreateObject("CDO.Configuration") With objCDOConfig.Fields .Item(strSch & "sendusing") = cdoSendUsingPort .Item(strSch & "smtpserver") = "mail.privagest.ch" ' Only used if SMTP server requires Authentication '.Item(strSch & "smtpauthenticate") = cdoBasic '.Item(strSch & "sendusername") = " '.Item(strSch & "sendpassword") = "YourPassword" .Update End With Set objCDOMessage = CreateObject("CDO.Message") With objCDOMessage Set .Configuration = objCDOConfig .From = "Name_From" .Sender = " .To = " '.Categories = "Privafax" '.Subject = "" '.Cc = "" ' Use TextBody to send Email in Plain Text Format .TextBody = "::C=none,H,p=high" ' Use HTMLBody to send Email in Rich Text (HTML) Format '.HTMLBody = "Test CDO Rich Text this is not Bold But BThis is!/B" ' Un-Rem next line to get "Return Reciept Request" '.MDNRequested = True End With If listOfAttachements.Count 0 Then intCounter = 1 While intCounter listOfAttachements.Count + 1 objCDOMessage.AddAttachment listOfAttachements.Item(intCounter) intCounter = intCounter + 1 Wend End If objCDOMessage.Send True '---------------- THE PROBLEM IS HERE ! MsgBox "Fax sent via e-mail.", vbInformation, "Privafax" Set objCDOMessage = Nothing Set objCDOConfig = Nothing End Sub |
#3
|
|||
|
|||
![]()
thanks.
"Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... You're mixing up two different CDO libraries. It's not your fault. Microsoft caused a lot of confusion when they gave CDO for Windows (what you're using) and CDO 1.21 (what has the saveCopy parameter) the same name. The Send method in CDO for Windows has no saveCopy parameter; see http://msdn.microsoft.com/library/en...af948785cb.asp Bottom line is that, since you're sending directly through an SMTP server and not through Outlook, you can't save it in Outlook's Sent Items folder. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Hello, I have written a code using vba and CDO object which works but I also would like to save a copy of the e-mail sent in the "Sent Items" folder in outlook. So, I have looked into MSDN and found the answer objMessage.Send( [saveCopy] [, showDialog] [, parentWindow] ) but it dose not work. I get an error ("wrong number of arguments or invalid property assignment")every time I run my add-in in outlook. How can I make this work ? Here's my code : Public Sub sendFaxViaEmail(listOfAttachements as Collection) Const cdoSendUsingPort = 2 Const cdoBasic = 1 Dim objCDOConfig As Object, objCDOMessage As Object Dim strSch As String strSch = "http://schemas.microsoft.com/cdo/configuration/" Set objCDOConfig = CreateObject("CDO.Configuration") With objCDOConfig.Fields .Item(strSch & "sendusing") = cdoSendUsingPort .Item(strSch & "smtpserver") = "mail.privagest.ch" ' Only used if SMTP server requires Authentication '.Item(strSch & "smtpauthenticate") = cdoBasic '.Item(strSch & "sendusername") = " '.Item(strSch & "sendpassword") = "YourPassword" .Update End With Set objCDOMessage = CreateObject("CDO.Message") With objCDOMessage Set .Configuration = objCDOConfig .From = "Name_From" .Sender = " .To = " '.Categories = "Privafax" '.Subject = "" '.Cc = "" ' Use TextBody to send Email in Plain Text Format .TextBody = "::C=none,H,p=high" ' Use HTMLBody to send Email in Rich Text (HTML) Format '.HTMLBody = "Test CDO Rich Text this is not Bold But BThis is!/B" ' Un-Rem next line to get "Return Reciept Request" '.MDNRequested = True End With If listOfAttachements.Count 0 Then intCounter = 1 While intCounter listOfAttachements.Count + 1 objCDOMessage.AddAttachment listOfAttachements.Item(intCounter) intCounter = intCounter + 1 Wend End If objCDOMessage.Send True '---------------- THE PROBLEM IS HERE ! MsgBox "Fax sent via e-mail.", vbInformation, "Privafax" Set objCDOMessage = Nothing Set objCDOConfig = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with calendar item & Outlook 2003 | Andreas Koepke | Outlook - General Queries | 1 | March 17th 06 10:40 AM |
Another problem with Symantec & Outlook | JohnM | Outlook - General Queries | 1 | February 24th 06 03:45 PM |
mapi cdo service | [email protected] | Outlook - General Queries | 8 | February 20th 06 03:33 PM |
Do i need Exchange for CDO | A. Peters | Outlook and VBA | 4 | February 18th 06 12:52 AM |
Problem opening photo attachments & word documents | donna | Outlook Express | 8 | February 17th 06 03:40 AM |