Batch Saving and converting a multiple documents from .docm to .docx

Dan-0910 0 Reputation points
2024-02-03T18:16:06.2533333+00:00

Hi, I have a shared business one drive (i am not the owner of it), with different folders and subfolders; in these folders and subfolders, I have different file types (Excel, PDF, images, word documents). To keep it short, we have .docm (having macros) documents that are causing us issues opening and editing online; there is no option to edit offline (since no access to Word offline, and we can't install third-party software on the system). So we need to convert all the .docm document files to .docx, these are in different folders. We need to replace all the original .docm files with the newer .docx file format so that the new .docm is in the same original file location. Can someone help me do this with a batch method (maybe through a script? However, you need to give me step-by-step instructions on what to do since I have never used these)? What I can do is download all the one drive folders, do the batch conversion offline and then re-upload it. I would appreciate all your help.

Microsoft 365 and Office Word For business Windows
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2024-02-03T20:13:07.9466667+00:00

    You'll have to remove a part of the DOCM file that contains the macros. Here's a link to an example with a function (in C#) that will do the conversion.

    https://learn.microsoft.com/en-us/office/open-xml/word/how-to-convert-a-word-processing-document-from-the-docm-to-the-docx-file-format?tabs=cs-0%2Ccs-1%2Ccs-2%2Ccs-3%2Ccs-4%2Ccs-5%2Ccs

    It shouldn't be too difficult to convert that to PowerShell.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.