• VBA Compile Problem

    Author
    Topic
    #354950

    Word97 – Office97 (SR2)

    I have a two part problem (they may be realted?)…

    1) Whenever I try to compile my VBA project within Normal.dot Word crashes with the following error…

    WINWORD caused an invalid page fault in
    module VBA332.DLL at 015f:651b41d3.

    This also happens when I run some of the functions/macros within my Normal.dot project/document.

    I’ve tried restoring the dll from disk, only to find its an older version and VBA won’t initialise.

    Any ideas on how I can repair this dll, or find a replacement, or an another solution?

    2) Normal.dot is standardised throughout our company, so that we can provide a familiar GUI to every user. The only problem is that the normal.dot file is large (just short of 1MB) and it takes time to open on slower machines. Compiling the VBA doesn’t appear to make a difference to the file size (and I can’t do it at the moment anyway – see above!).

    Is there any way to reduce the file size of normal.dot without removing code and functionality? Are there any third party “compactors” (?) available?

    Any ideas folks?

    Thanks in anticipation…

    Ade

    Viewing 1 reply thread
    Author
    Replies
    • #522642

      Hi there – thanks for responding!

      Re: IPF – I’ll have a look at the KB article – thanks, my searches on MSKB had proved fruitless!

      Re: Shared Normal.dot – god no! Wouldn’t dream of sharing it on a network amongst 30’odd users!! Will look into transferring macros/VBA to a global add-in though; this should reduce the size of the normal.dot.

      Many thanks,

      Ade

    • #522654

      Me again!

      The first solution in the KB article didn’t work and the second refers to NT platforms (sorry, forgot to say I’m in Win98). However…

      moving all my vba macros to a global template has halved the normal.dot and I can now compile the global template! Guess the normal.dot I was using was just too big for VBA to handle in one go ??

      Do have something further to test your brain with (and anyone else who’s out there?)…

      When I exit Word, it sometimes asks if I want to save the global template – I don’t want users to be able to change it though. Previously I’ve made the file read-only and used a VBA procedure to Exit Word and prevent changes to the normal.dot template…

      Sub ExitWord()
      NormalTemplate.Saved = True
      Application.Quit
      End Sub

      This works just fine when a user exits via a toolbar button that runs this macro, and I’ve added in the line…

      Templates(“C:Program FilesMicrosoft OfficeOfficeStartupGlobal_pde.dot”).Saved = True

      …to prevent changes to the loaded global template also.

      However, I’ve always had the problem that if users exit via the application window “x” button the macro doesn’t run and the user gets prompted to save the normal.dot template. This results in numerous copies of normal.dot; which, as you rightly point, out causes all sorts of problems.

      I’ve tried trapping this event with the AutoExit() macro feature, but it doesn’t work…

      Sub AutoExit()
      NormalTemplate.Saved = True
      End Sub

      Any ideas on how to trap the application window “x” button exit event? Otherwise, I’m going to have numerous copies of the global template flying around ?

      Many thanks again,

      Cheers!

      Ade

      • #522704

        See: Template Basics (http://www.addbalance.com/usersguide/templates.htm) for more on global templates and Normal.dot.

        • #522984

          Thanks for the pointers – some really useful tips and tricks and I’ve been at this Word VBS programming thing for a few years now! Thanks.

          I couldn’t actually see anything that answered my query about the application close button not triggering AutoExit macros though?

          Did I miss something??

          Thanks again,

          Ade

          • #523065

            No, you didn’t miss anything. Since you noted that you were switching to a global template, I thought you might be able to use the info.

            As far as reducing template bloat, Payne consultants had a code cleaner ADD-IN that worked very well. I think it is available as a download from the CompuServe Word newsgroup.

            As far as the x event, don’t have a clue. Have you checked the Word MVP website? They have several pages on using document events. You might want to post this in the VBA lounge here and on the word.vba.general newsgroup at microsoft.

    Viewing 1 reply thread
    Reply To: Reply #523065 in VBA Compile Problem

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel