tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,926
- Office Version
- 365
- 2019
- Platform
- Windows
I have some standard code in Excel which instructs Outlook to send e-mails.
Sometimes the program runs all the way to the end with no problems but at other times, it crashes.
These are the lines of code in question:
It crashes on this line:
with the error message:
but when I drag the cursor back to this line:
and press run, the program continues without any problems.
What coudl be the problem and how might I be abke to fix it?
Thanks
Sometimes the program runs all the way to the end with no problems but at other times, it crashes.
These are the lines of code in question:
Code:
Dim objOutlook As Object
Set objOutlook = CreateObject("Outlook.Application")
Dim objMail As Object
Set objMail = objOutlook.CreateItem(0)
It crashes on this line:
Code:
Set objMail = objOutlook.CreateItem(0)
with the error message:
Code:
run time error 462 the remote server machine does not exist or is unreachable
but when I drag the cursor back to this line:
Code:
Set objOutlook = CreateObject("Outlook.Application")
and press run, the program continues without any problems.
What coudl be the problem and how might I be abke to fix it?
Thanks