Reputation: 21
I am trying to open a .bat file from outlook VBA. My code worked until this last week.
Here is the Code:
Sub Daily_batch_file(Mail As MailItem)
Call Shell("P:\my path\my bat.bat", vbNormalFocus)
End Sub
I have a rule that kicks this script off when I receive a particular email. I am getting an invalid call error but haven't been able to figure it out. Any suggestions?
Upvotes: 2
Views: 5766
Reputation: 131
Instead of call .bat file from VBA, maybe you can open it using Rule from outlook. It's pretty simple.
Just create a blank rule with the specific word in the subject/body (or you can choose any condition based on your situation). And then in the Select Action window, tick the "Start Application" and then find your .bat/.exe file.
I hope it's clear enough.
Thanks
Upvotes: 4