1
votes

I use MS Office 2013 and Windows 7 in a networked environment.

I have an auto-open Excel VBA program that sends files via Outlook and is scheduled via Task Scheduler.

This ran when I was on MS Office 2010, but my computer was wiped and reinstalled with MS 2013.

Some key points:

  1. The Excel files all work when I run them directly and the emails get sent via Outlook.

  2. Task Scheduler works when I use the setting "Run only when user is logged on" and emails get sent via Outlook.

  3. Task Scheduler works with the other parts of the Excel VBA when it runs as "Run whether user is logged on or not," but does not successfully send Outlook files. I know this because I included a line to save a file in a particular directory and it did save it there. I also saw Excel in the Task Manager processes. So it runs, but does not send the Outlook email.

Things I have tried already:

  1. Changed DCOM settings for Microsoft Excel and Outlook Message Attachment
  2. Created "C:\Windows\System32\config\systemprofile\Desktop" and "C:\Windows\SysWOW64\config\systemprofile\Desktop" directories
1
Verify macro security settings. - Mathieu Guindon
I mean all you know is that Excel runs, which means the scheduler is still working. What you don't know is whether the macro is still allowed to run. Comment-out everything and put up a single MsgBox "Works" instruction in your auto-open macro. Run scheduled task - if no msgbox pops up, you know the macro isn't running. So, make sure macro security allows that macro to run, and/or put the workbook in a trusted location. - Mathieu Guindon
Thank you for the comment. I know the non-Outlook parts work because I have a line that saves a file at the end, which it does. It also works completely (including Outlook) when I choose "Run only when user is logged on." I also tested MsgBox, which works as well when logged on, but it's a background process when you run it when not logged on, so I rely on the file method. Everything is also in a trusted location. - user10559826
Is it possible, the server limited your permissions in the task scheduler. - Alina Li
That's a possibility. All these used to work fine on my old system, but after a recent attack, everything was wiped and reinstalled. Some of the new security setting may be the cause. If I can't figure out any other reason, that's probably it. I do have batch job rights and changed the DCOM settings for Excel and Outlook to give me full access, but there could be other settings I don't know about. - user10559826

1 Answers

0
votes

Using the Outlook Object Model in a Task Scheduler or in the context of a Windows Service is not supported, so this could explain some of the unexpected behaviour. See: https://support.microsoft.com/en-ca/help/237913/the-outlook-object-model-is-unsuitable-to-run-in-a-windows-service