0

I have a VBS script that loops over doc and docx Word files and converts them to PDF. I run the script from a Windows 2021 server machine. I know that Microsoft discourages server-side automation for office, but in my environment I have no choice.

The script runs fine interactively. However, once ran via task scheduler when I'm logged out, the script fails because method Documents.Open fails:

'file is a handle to a file on the filesystem
Set doc = oWord.Documents.Open(CStr(file), , , msoFalse) 'This fails

The script simply stops, the task scheduler returns code 0 for the task. Creating the following folders didn't help:

 C:\Windows\SysWOW64\config\systemprofile\Desktop
 C:\Windows\System32\config\systemprofile\Desktop

How can I diagnose the issue?

grutcblu
  • 21
  • 3

0 Answers0