#  Other Applications & Softwares  > Outlook Formatting & Functions >  >  running vba outlook macro from cmd line prompt

## craigm2

I am trying to set up a batchfile activated by task scheduler that would make reports and then email them.  The reports are made the.  The macro works to email them but I can't get the batch file to tell outlook to send the emails

Here is the batch command to call the macro to send the email

"C:\Program Files\Microsoft Office 15\root\office15\OUTLOOK.EXE" /autorun "email_EDI"


In the Thisoutlooksession module is this macro

Public Sub email_EDI()
    Dim olApp As Outlook.Application
    Dim objMail As Outlook.MailItem
    Set olApp = Outlook.Application
    Set objMail = olApp.CreateItem(olMailItem)
    objMail.BodyFormat = olFormatPlain
    objMail.Subject = "xxxxxxxxxxx"
    objMail.Body = ""
   objMail.To = "edi@xxxxxxx.com"
    objMail.Send
End Sub


Is there a way to trouble shoot this?  No Errors are displayed but no emails are sent.  I am using Outlook2013

----------


## skatonni

Sometimes unsupported functionality still works but you may have to find another solution.

Not found in list of command line switches for 2013:
https://support.office.com/en-ca/art...5-441737deb3a6

autorun is "no longer supported after Outlook 2003 SP2":
http://www.howto-outlook.com/howto/c...neswitches.htm

Notice there are no quotes around macroname in the second link:
/autorun macroname

----------


## craigm2

Should I be able to call a  .vbs script from the .bat that would pass the job off to outlook?

----------

