×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Outlook Macro to run via VBScript with Windows Task Scheduler

Outlook Macro to run via VBScript with Windows Task Scheduler

Outlook Macro to run via VBScript with Windows Task Scheduler

(OP)
This does not work.
I get

Object doesn't support the property or method:
'myOutlook.SendNewestFiles'

CODE

Set myOutlook = CreateObject("Outlook.Application")
myOutlook.ThisOutlookSession.SendNewestFiles or myOutlook.SendNewestFiles
myOutlook.Quit
Set myOutlook = Nothing 
as well as the switch for Office 2016 in Task Scheduler

CODE

"C:\.... Outlook.exe" /m ThisOutlookSession.SendNewestFiles 

Anyone know the correct VBS code to launch and run an Outlook Macro?
Or another way?

I tried the Application_StartUp but do not want to have it run every time Outlook is opened.
Otherwise have to open in Safe Mode to use Outlook regularly.

RE: Outlook Macro to run via VBScript with Windows Task Scheduler

supportsvc,
don't search for solution randomly. Each of office applications has its own set of switches, this also depend on office version. For outlook, /m adds e-mail name to the item, so no way to run macro with it.
Outlook has no direct way to run its macro remotely.
I think that you have only two possibilities:
1. transfer the code from outlook and adapt it in VBS, as I suggested in VBA forum. You will have the script a bit longer, but will do the same what the code in outlook does,
2. try to create another "otm" file with outlook vba project. Put your macro there and call it in the Application_StartUp event procedure in this project. Open outlook from VBS with the alternative vba project using /altvba switch, see ms office support for details.

combo

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close