none
How to compare VBA modules in a .dotm file RRS feed

  • Question

  • Hallo

    How can i compare VBA Modules in a .dotm File?

    I made some VBA Modules for "Word for Mac 2011" and the same Modules for "Microsoft Word 2010" now it would be very helpful to compare these modules.

    I found this tool:
    http://www.formulasoft.com/vba-compare-history.html

    But this supports only Word files until "Microsoft Word 97".

    Does someone know a tool wich i can use without saving my files in the old format?


    Tuesday, June 23, 2015 7:16 AM

Answers

  • Hi =?utf-8?B?TWljaGEgSMOkc2xlcg==?=,
     
    What I would do is export the modules from both Word documents (rename them so
    their names are clearly indicating the WOrd doc they belong to) and then use a
    tool like ExamDiff to compare differences.
     
    I have an Excel tool which enables you to export the entire VBA project from an
    Excel file, perhaps you can fit it to also export WOrd VBA projects?
    www.jkp-ads.com/download.asp#exportvbaproject
     
     

    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    • Marked as answer by Micha Häsler Wednesday, June 24, 2015 11:32 AM
    Tuesday, June 23, 2015 9:18 AM
  • I have used an addin called Word Code Cleaner that exports/imports all VBA modules.  It has an option to not delete the modules it exports.  I use WinMerge to compare modules.

    Word Code Cleaner

    WinMerge


    Word Code Cleaner may not work on A Mac but maybe you can get it to work otherwise you'll need to manually export the needed modules.  I use Word 2010.

    • Edited by mogulman52 Tuesday, June 23, 2015 5:43 PM
    • Marked as answer by Micha Häsler Wednesday, June 24, 2015 11:31 AM
    Tuesday, June 23, 2015 5:31 PM
  • Two things I recommend:

    1. Open each module then copy paste the code into a blank Word doc so you have two docs. Then use Word's Compare feature to see differences
    2. Create a module that holds only code that is or should be exactly the same in both versions. This code can be replaced as required.
      In a separate module have code specific to Windows or Mac. This module needs careful updating so it continues to work.

    Separate modules like this will make keeping code up to date easier, quicker and safer.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    • Marked as answer by Micha Häsler Wednesday, June 24, 2015 11:32 AM
    Tuesday, June 23, 2015 9:24 PM

All replies

  • Hi =?utf-8?B?TWljaGEgSMOkc2xlcg==?=,
     
    What I would do is export the modules from both Word documents (rename them so
    their names are clearly indicating the WOrd doc they belong to) and then use a
    tool like ExamDiff to compare differences.
     
    I have an Excel tool which enables you to export the entire VBA project from an
    Excel file, perhaps you can fit it to also export WOrd VBA projects?
    www.jkp-ads.com/download.asp#exportvbaproject
     
     

    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    • Marked as answer by Micha Häsler Wednesday, June 24, 2015 11:32 AM
    Tuesday, June 23, 2015 9:18 AM
  • I have used an addin called Word Code Cleaner that exports/imports all VBA modules.  It has an option to not delete the modules it exports.  I use WinMerge to compare modules.

    Word Code Cleaner

    WinMerge


    Word Code Cleaner may not work on A Mac but maybe you can get it to work otherwise you'll need to manually export the needed modules.  I use Word 2010.

    • Edited by mogulman52 Tuesday, June 23, 2015 5:43 PM
    • Marked as answer by Micha Häsler Wednesday, June 24, 2015 11:31 AM
    Tuesday, June 23, 2015 5:31 PM
  • Two things I recommend:

    1. Open each module then copy paste the code into a blank Word doc so you have two docs. Then use Word's Compare feature to see differences
    2. Create a module that holds only code that is or should be exactly the same in both versions. This code can be replaced as required.
      In a separate module have code specific to Windows or Mac. This module needs careful updating so it continues to work.

    Separate modules like this will make keeping code up to date easier, quicker and safer.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    • Marked as answer by Micha Häsler Wednesday, June 24, 2015 11:32 AM
    Tuesday, June 23, 2015 9:24 PM
  • Actually, WinMerge is much better than Word's compare feature.  It is designed specifically for comparing and merging code.
    • Marked as answer by Micha Häsler Wednesday, June 24, 2015 11:32 AM
    • Unmarked as answer by Micha Häsler Wednesday, June 24, 2015 11:32 AM
    Tuesday, June 23, 2015 10:51 PM
  • Thanks for Your helpful tips!

    Wednesday, June 24, 2015 11:34 AM
  • I made a add-on for "Microsoft Word 2010".
    This add-on replaces the "FileSave" command and exports the VBA-Modules after saving the document.

    On "Word 2011 for Mac" replacing of the "FileSave" command works but the "ExportModules" produces an error.

    Does someone know a solution to expoert VBA-Modules with VBA-Code on "Word for Mac 2011"?


    Best regards

    Micha

    PS: Actual i started compare files and define versions with git.




    Thursday, August 13, 2015 8:23 AM