Share via

Getting invalid directory error while opening a .docm file programatically

Anonymous
2024-08-26T08:00:10+00:00

We are running a command programmatically using api createProcess.

Command -

"C:\Program Files\Microsoft Office\Root\Office16\WINWORD.EXE" /q /a /msaveAsPDF "D:\work\***\sample.docm"

where saveAsPDF is a macro.

Error from Word : The directory name is not valid. (C:\Users\xx\source...\microsoft.doc)

After clicking OK on error, process completed.

If we use Word 2016, this works fine but we are facing issue on Office 2019 and 365.

If I run this command from command prompt, it works fine without error.

What is the cause of this error?

Microsoft 365 and Office | Word | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-08-27T06:55:44+00:00

    Dear Dinesh,

    Sorry for that our category may have limited resources on the Office API related issues and questions.

    I suggest you post a new thread on our specific support channel Office Development - Microsoft Q&A for further help.

    Meanwhile, we'll keep the thread open and welcome other experienced community members to share suggestions and opinions.

    Your understanding is greatly appreciated!

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments