none
Cannot Edit Old macros in MS Word 2010 64 bit RRS feed

  • Question

  • I have a word Template with VBA Macros created from old version of MS Word. When I try to edit the macros I get the error, "Compile Error in hidden module: ThisDocument. This error commonly occurs when code is incompatible with the version, platform or architecture of this application...."
    I know that the code is not 64 bit compatible, I am trying to edit  the code to make it 64 bit compatible, but Word would not let me see the code at all....

    Can anyone help ?

    Thanks!
    Monday, July 2, 2012 4:03 PM

Answers

  • Hi Solutionsearcher,

    Thank you for posting in the MSDN Forum.

    In your post, you mentioned:
    >I have a word Template with VBA Macros created from old version of MS Word.
    So it is a .dotm file, right?

    You can follow steps below to see the macro code.
    1. Startup Word Application.
    2. Click the File tab, use Open option to open your .dotm file.
    3. Click the File tab again, and then click Options.
    4. In the popped-up window, choose Customize Ribbon option, and then make sure the checkbox of Developer is checked.
    5. Click Ok button to go back to the application Window. Click the Developer tab, and then click Visual Basic.
    After these steps, you'll see the code of your .dotm file.

    Hope it helps. If anything is not clear, please feel free to let me know.

    Best regards,
    Quist


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, July 4, 2012 8:05 AM
    Moderator
  • Hi searcher

    I take it this error is appearing when you try to access the VBA Editor to view it?

    Do you still have an older version of Word somewhere, preferably the version used to create the template? Can it be opened in that version?

    If yes, my recommendation would be to use the File/Export file command to save the macros in the template to pure text files (back them up). Then delete all the project files (macro "sheets") in the document and all the code from the ThisDocument sheet. Save the document, close it, then try opening it again in Word 2010.

    Can you now access the VBA Editor?

    If yes, you should be able to use File/Import to bring in the macro code from the text files.

    If not, then the document is damamged at a fairly deep level. You could try saving it as a *.dotx file (cutting off the macro storage), open that and see if you can access the VBA editor. If you can, you can resave it as *.docm and import the macros saved in text files.

    If that doesn't work, then you need to try saving it as a "web page" or as rtf, close, open and save again as a dotx file.


    Cindy Meister, VSTO/Word MVP

    Wednesday, July 4, 2012 8:15 AM
    Moderator
  • Thanks for your response...I got it to work using a round about way and then saw the response above, which worked too.

    The file was not corrupted. Word was not letting me into the VB code to make it 64 bit compatible for it to run. So tried to create a new macro and then it let me into the VB code, so I went ahead and made changes to the VB code and saved it as a dotm file (it was dot file from older version of Word)

    But I guess , switching on the developer mode is more correct way of doing it.

    Thank you!

    Tuesday, July 10, 2012 2:21 PM

All replies

  • Hi Solutionsearcher,

    Thank you for posting in the MSDN Forum.

    In your post, you mentioned:
    >I have a word Template with VBA Macros created from old version of MS Word.
    So it is a .dotm file, right?

    You can follow steps below to see the macro code.
    1. Startup Word Application.
    2. Click the File tab, use Open option to open your .dotm file.
    3. Click the File tab again, and then click Options.
    4. In the popped-up window, choose Customize Ribbon option, and then make sure the checkbox of Developer is checked.
    5. Click Ok button to go back to the application Window. Click the Developer tab, and then click Visual Basic.
    After these steps, you'll see the code of your .dotm file.

    Hope it helps. If anything is not clear, please feel free to let me know.

    Best regards,
    Quist


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, July 4, 2012 8:05 AM
    Moderator
  • Hi searcher

    I take it this error is appearing when you try to access the VBA Editor to view it?

    Do you still have an older version of Word somewhere, preferably the version used to create the template? Can it be opened in that version?

    If yes, my recommendation would be to use the File/Export file command to save the macros in the template to pure text files (back them up). Then delete all the project files (macro "sheets") in the document and all the code from the ThisDocument sheet. Save the document, close it, then try opening it again in Word 2010.

    Can you now access the VBA Editor?

    If yes, you should be able to use File/Import to bring in the macro code from the text files.

    If not, then the document is damamged at a fairly deep level. You could try saving it as a *.dotx file (cutting off the macro storage), open that and see if you can access the VBA editor. If you can, you can resave it as *.docm and import the macros saved in text files.

    If that doesn't work, then you need to try saving it as a "web page" or as rtf, close, open and save again as a dotx file.


    Cindy Meister, VSTO/Word MVP

    Wednesday, July 4, 2012 8:15 AM
    Moderator
  • Thank You! that worked.

    FYI, it was not a dotm file, it was .dot file (Word 97-2003 format template)

    Tuesday, July 10, 2012 2:17 PM
  • Thanks for your response...I got it to work using a round about way and then saw the response above, which worked too.

    The file was not corrupted. Word was not letting me into the VB code to make it 64 bit compatible for it to run. So tried to create a new macro and then it let me into the VB code, so I went ahead and made changes to the VB code and saved it as a dotm file (it was dot file from older version of Word)

    But I guess , switching on the developer mode is more correct way of doing it.

    Thank you!

    Tuesday, July 10, 2012 2:21 PM