Trapping errors in Sendemail vb script
Moderators: Dorian (MJT support), JRL
Trapping errors in Sendemail vb script
I'm trying to trap for errors in sendemail vbscript. This is usually because of a bad smtp server. I've used On error Resume next and can see the err.number 0 within the vbscript but I can't get that to return within macro scheduler so I can write the error to a text file. Any ideas?
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Just set the error number to a global VBScript variable and then retrieve it with VBEval:
Code: Select all
VBSTART
Dim gErrorNum
Sub SomeSub
On Error Resume Next
.. do something
gErrorNum = Err.Number
End SomeSub
VBEND
VBRun>SomeSub
..
VBEval>gErrorNum,locErrorNum
MessageModal>Error: %locErrorNum%
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?