Question : Excel VBA -- Using .xlT File to Send E-Mail with .xlS File Attachment (NEW QUESTION)

We recently upgraded, on our network, to Excel 2003, SP-1.  Also, we upgraded to W XP Pro, Vers. 5.1, SP-2.  Since the upgrade, I am getting the following error message when the macro tries to send an e-mail:

Run-time error '48':
Error in loading DLL
The above pops up when the macro hangs on the line -- Set Flds = iConf.Fields

I will post the e-mail portion of my code below.

The References that I have selected are:
- Visual Basic for Applications;
- MS 11.0 Object Libraries for:  Excel, Outlook, Word, and Office;
- OLE Automation;
- MS CDO for Windows 2000 Library; and
- MS ActiveX Data Object 2.5 Library.

Here is the e-mail code:

Option Explicit
Dim myPath2, fNameSaved, strTo, strFrom As String
Dim myDate As Variant
Dim iMsg, iConf
Dim Flds As ADODB.Fields

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

strTo = "[email protected]"
strFrom = "[email protected]"
   
‘APPLY SETTINGS TO THE CONFIGURATION OBJECT
With Flds
        .Item(cdoSendUsingMethod) = cdoSendUsingPort  '2
        .Item(cdoSMTPServerPort) = 25
        .Item(cdoSMTPServer) = "smtp.na.suchserver.com"
        .Item(cdoSMTPAuthenticate) = cdoBasic           '1; "CLEAR-TEXT" AUTHENTICATION
        .Item(cdoSendUserName) = "abcdef"
        .Item(cdoSendPassword) = "@Pass11"

        '.Item(cdoSMTPUseSSL) = True/False              'Use SSL to connect to the SMTP server

        .Item(cdoSMTPConnectionTimeout) = 10          'VALUE IS IN SECONDS
        .Update
 End With

 'APPLY SETTINGS TO THE MESSAGE OBJECT
 With iMsg
        Set .Configuration = iConf
        .To = strTo
        .From = strFrom
        .Subject = "TOPIC OF INTEREST"
        .TextBody = "SEE ATTACHED FILE FOR COMMENTS ON DAILY ADJUSTMENT."    
        .AddAttachment fNameSaved
        .Send
    End With

    'VARIABLE CLEAN-UP
    Set Flds = Nothing
    Set iConf = Nothing
    Set iMsg = Nothing

I have another e-mail macro (not created with an .xlT file sent to users) that continues to work since the above upgrades -- this is puzzling.

JingleRock

Answer : Excel VBA -- Using .xlT File to Send E-Mail with .xlS File Attachment (NEW QUESTION)

JingleRock:

Do you have similar problems if you Step Through (F8) the code?

Jaes
Random Solutions  
 
programming4us programming4us