I have some macro code in an Excel workbook. It has been working fine for several years under various combinations of Excel 97, Excel 2000, Excel 2002(XP) and Excel 2003 along with Outlook 97, Outlook 2000, Outlook 2002(XP) and Outlook 2003. We have one new computer that has Office 2003 (SP2) that was recently setup and the macro generates the following error:
Run-time error '-2147024770(8007007e)':
Automation error
The specified module could not be found.
Here is the VBA code in the Excel Macro. The error happens when it reaches the line that reads: Set theApp = CreateObject("Outlook.Application"). I tried to run the macro on two other Office 2003 SP2 computers and they worked OK, which shot my theory that it was strictly related to Office 2003 SP2. So far it's only one user who had this problem.
Dim theApp, theNameSpace, theMailItem, myAttachment, MessageBody, subject
'create a new Outlook Application Object,
'direct it to the proper NameSpace,
'create a new Mail Item and set the attachments collection
Set theApp = CreateObject("Outlook.Application") 'error occurs here
Set theNameSpace = theApp.GetNameSpace("MAPI")
Set theMailItem = theApp.CreateItem(0)
Set myAttachment = theMailItem.attachments
'add recipients to MailItem
theMailItem.Recipients.Add john.doe@hotmail.com
theMailItem.subject = subject
theMailItem.Body = MessageBody
myAttachment.Add fName, 1, 1, subject
theMailItem.Send
theNameSpace.Logoff
Any advice, solutions, or suggestions are welcomed and appreciated.
Thanks!
P.S. Here is a screen shot of the error
<img src="http://www.asi.com/vbaerror.jpg">