Results 1 to 6 of 6
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Comparing templates VBA code (Word97/SR2 et al.)

    I need a utility to compare two Word termplates (but it may as well compare any two projects from the same breed, i.e. compare two Excel sheets/templates/addins etc).


    Here I am with several versions of, say, Utils.dot, all within a few days of each other, and I'd like to know where they differ. I know that there will be some grunt work, but a utility that highlights at least

    1) differences in module names ("TEMPLATEA has a module 'NEW', and TEMPLATEB doesn't have this module").

    2) differences in module code ("module UT of TEMPLATEA was identical to module UT of TEMPLATEB until I reached THIS line of source").

    3) options switch to disregard comment lines (OK, I make heavy use of Payne Consulting's EXCELLENT VBA code cleaner).



    I could develop it by cannibalising an existing VBA code utility, soch as Procedure Stripper, or Procedure Clipper, but I'd rather not do the work.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Comparing templates VBA code (Word97/SR2 et al.)

    Why don't you just use Visual Source Safe, Chris, and store your code projects there. You can compare between any two objects in VSS and even between versions of the same object, and it allows you to share code and objects between projects.
    Charlotte

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Comparing templates VBA code (Word97/SR2 et al.)

    Charlotte,

    I agree about the value of VSS, but have never been able to get it to compare versions of Word .dot files (which in our case contain .bas and .frm modules).
    If I view Versions, select two versions and then click on Diff, eventually I get a message saying "Binary files differ".

    Have never tried it, but wonder if you would need to check say the modules' .bas files individually, in order to get VSS to do a compare. Unfortunately that doesn't jibe with how we use VSS with Word .dots, which is just to check in the .dot as a whole, rather than as individual pieces.

    Gary

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Comparing templates VBA code (Word97/SR2 et al.)

    I haven't really tried VSS with Word templates, so I can't say. You can add a Word project to VSS and it goes in as a class which contains the objects in the project but not, apparently any templates. You can add a template project to VSS, but I don't know how well it would work. If there are multiple versions in the history, it should allow you to compare them.
    Charlotte

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comparing templates VBA code (Word97/SR2 et al.)

    If your goal is to compare the macro code, then save the code from each template to .BAS files and compare those. You can use the FC.EXE command supplied with windows (it is a carry over from DOS days) if you don't have anything better. Or you could use Word's document compare on the .BAS files.

    Neither has the advanced options you'd like, but there are tools that do. The GNU diff command does have the options that you'd like. There is a version that runs under Windows (or DOS). The latest version can handle long file names but the earlier versions won't.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comparing templates VBA code (Word97/SR2 et al

    > If your goal is to compare the macro code,

    Thanks, but no. I really want to get a comprehensive report on the entire project, so comparing macro code (alone) won't do it. Maybe THIS project has a module "Module4" that is lacking in the other module.

    And since it IS VBA code, I'd always want an option that allowed me to ignore comments, as defined in Payne Consulting's Code Cleaner.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •