Automation Error

alexaronson

Active Member
Joined
Sep 30, 2005
Messages
314
Hi and thank you for your help,

I have small macro that process information into a usable format, saves it to a new file, and attaches the new file to an outlook email and sends it to specific people.

When I built my macro and executed it the first time I had no problems.

When I went to run it again the next day, I am getting:

****************************************
"Run-time error '-2147417856 (80010100)':

Automation error
System call failed.
****************************************

When I go to debug, I can just hit play and it continues on and finishes sending the email.

Code:
folder = "C:\Users\TE114889\My Documents\Send to TEIS\"
BORfile = wbName
'the code stops on the next line
With CreateObject("Outlook.Application").CreateItem(0)
    .To = "test@test.com"
    .Subject = "AMS BOR"
    .Body = "AMS BOR sample file to try.  Column A = Part Number, Column B = Description, Column C = Work Center, Column D = Activity Type, Column E = Value.  This email, file, and text was created and sent by a macro.  How cool is that!"
    .attachments.Add folder & BORfile
    .Send
End With

BORfile and folder are declared as strings in the first part of the code.

Any suggestions as to what to do to prevent this error message or on how I can get vba to blow through the error?

Thanks in advance.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Is the application not open when your macro initially runs? My guess is perhaps you are attempting to feed information to Outlook before Outlook loads... that would explain why it continues on after you get to debug mode. I don't have outlook, so not able to actually provide any specific help on the error :(
 
Upvote 0
Hi,

I am facing a similar problem. Did you manage to find a solution?

Thanks,
S







Hi and thank you for your help,

I have small macro that process information into a usable format, saves it to a new file, and attaches the new file to an outlook email and sends it to specific people.

When I built my macro and executed it the first time I had no problems.

When I went to run it again the next day, I am getting:

****************************************
"Run-time error '-2147417856 (80010100)':

Automation error
System call failed.
****************************************

When I go to debug, I can just hit play and it continues on and finishes sending the email.

Code:
folder = "C:\Users\TE114889\My Documents\Send to TEIS\"
BORfile = wbName
'the code stops on the next line
With CreateObject("Outlook.Application").CreateItem(0)
    .To = "test@test.com"
    .Subject = "AMS BOR"
    .Body = "AMS BOR sample file to try.  Column A = Part Number, Column B = Description, Column C = Work Center, Column D = Activity Type, Column E = Value.  This email, file, and text was created and sent by a macro.  How cool is that!"
    .attachments.Add folder & BORfile
    .Send
End With

BORfile and folder are declared as strings in the first part of the code.

Any suggestions as to what to do to prevent this error message or on how I can get vba to blow through the error?

Thanks in advance.
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,271
Members
449,219
Latest member
daynle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top