Relative Content

Tag Archive for vbams-wordmacros

Is there a way to adjust the height of a text content control in MS Word through VBA?

I have VBA code that creates a table dynamically depending on user selections in MS Word. The table will have content controls in them to ensure proper formatting. However, the content controls are too tall for the row height, and so they partially cover the cells underneath them that may also contain content controls. Is there a way when creating those controls to limit their height so that there is no overlap?

Word Macro return “Command Failed” when called SaveAs() method

I’m investigating an issue that one of my colleagues experiencing. Background on the issue is that we have an .net application function which opens a word document template, save the word document in a temporary folder in user’s PC and let the user edit the document. Once everything is done, the document saves upon closing. However, sometimes when user open the document it leads to Command Failed error. However, this is an intermittent issue where the same user can open other documents. When I tried to isolate the issue, following code black leads to the error and I think the issue is with masterDocument.SaveAs (AddBackslash(Settings.WorkingFolder) & fileNameString) lead to the error. But as per my understanding the code is okay and the issue is only happening on certain documents. (Another user can open the same document without an issue)