Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

CDO Message

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SHIPP - 18 Mar 2008 02:09 GMT
I obtained the following code from this site. It doesn't work. Most likely my
fault. I believe it is in the configuration. What do each of the .item fields
mean?

Sub CDOTestFive()
'set the following References from the Menu bar under Tools then References
'Microsoft CDO for Windows 2000 Library
'Microsoft ActiveX Data Objects 2.5 Library

 Dim iMsg As CDO.Message
 Dim iConf As CDO.Configuration
 Dim Flds As ADODB.Fields
 Dim strHTML As String

 On Error GoTo HandleErr

 Set iMsg = New CDO.Message
 Set iConf = iMsg.Configuration
 Set Flds = iConf.Fields

 With Flds
   .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort
   .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"propexbe.propeople.org"
   
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
   .Update
 End With

 strHTML = "<HTML>"
 strHTML = strHTML & "<HEAD>"
 strHTML = strHTML & "<BODY>"
 strHTML = strHTML & "<b><p>Please let me know if you got an attachment and
if you could open it. Thanks.</p></b></br>"
 strHTML = strHTML & "<b><p>Also please let me know if the text of the
message is bold.  Thanks.  </b></p>"
 strHTML = strHTML & "</BODY>"
 strHTML = strHTML & "</HTML>"

 With iMsg
   Set .Configuration = iConf
   .To = "MikeShipp@aol.com"
'   .CC = "Michael.Shipp@safeway.com"
   .From = "MikeShipp@aol.com"
   .Subject = "Please read:  test CDOSYS message with Attachment13"
   .HTMLBody = strHTML
   .Send
 End With

 MsgBox "Mail Sent!"

 Set iMsg = Nothing
 Set iConf = Nothing
 Set Flds = Nothing
 
ExitHere:
 Exit Sub

HandleErr:
 Select Case Err.Number
   Case Else
     MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical,
strProcName
 End Select

End Sub

Signature

M. Shipp

JP - 18 Mar 2008 14:38 GMT
You'll get more help if you post this in an Outlook newsgroup, for
example

microsoft.­public.­outlook.­program_vba
microsoft.­public.­office.­developer.­outlook.­vba

Also "it doesn't work" isn't going to inspire someone to help you. You
should post more details such as

What program are you using to do the automating?
What version of Office are you using?
What is the purpose of the code, and the intended outcome?
Are you using Option Explicit?
Did you use Debug>Compile to check for errors before running the code?
If the code runs and then stops, what line does it stop at?

HTH,
JP

> I obtained the following code from this site. It doesn't work. Most likely my
> fault. I believe it is in the configuration. What do each of the .item fields
[quoted text clipped - 67 lines]
> --
> M. Shipp
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.