Results 1 to 14 of 14
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Bloated template (WinNT4/Word97)

    I am working on a template that, granted, is fairly complicated - about 32 pages of code when printed and 6 userforms - and have been doing so on an almost continuous basis for more than two months.

    I noticed recently that the size of the template has been growing every time it is saved (even if the work done was to remove some code!) and within the next save or two it is going to go over the 1Mb mark.

    A template this size is going to have operational complications (especially if it and its two almost identical sister templates keep growing every time they are edited!), so does anyone know of a way to get it to let go of all the junk it is carrying and return to a more sensible size?

    Many thanks
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bloated template (WinNT4/Word97)

    Do you have "Allow Fast Saves" turned on in the Save tab of Tools | Options...? If so, turn it off immediately, for it is a certain way to bloat, and eventually corrupt, your Word documents and templates.
    Code and userforms tend to pick up fluff in the course of time. See Combatting Template Bloat for ways to get rid of this. Near the bottom of the page, you can download an add-in that will "clean" your code.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    Hans, is there no end to what you know about MS Office?!

    I had found a rough and ready way to get rid of the bloat - take a copy of the basic template this one started off from and copy all the code, forms, content, etc over to that instead. It's now down to 253kb!

    I would very much like to try the code cleaner but unfortunately our Ops people are going through a draconian phase and have blocked ALL downloads for everyone here at the moment; is there any chance you could grab a copy and email it to me?

    Pretty please? <img src=/S/grovel.gif border=0 alt=grovel width=31 height=23> ( <img src=/S/grin.gif border=0 alt=grin width=15 height=15> )
    Beryl M


  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bloated template (WinNT4/Word97)

    (Edited) I have sent the zip file to your e-mail address.

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    Thanks, Hans - attaching it to a post wouldn't have helped, I would still have had to download from the lounge!

    Come to that, aren't there copyright issues - something to do with being allowed to take a copy for yourself but not post it somewhere else for distribution? I seem to remember that coming up once before when someone attached something to a post ...

    Anyway, thanks again!
    Beryl M


  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bloated template (WinNT4/Word97)

    You're correct, I wasn't thinking very clearly. I have edited my previous reply to protect the guilty (=me) <img src=/S/grin.gif border=0 alt=grin width=15 height=15>.

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Bloated template (WinNT4/Word97)

    Just for laughs, if you export all modules and import into a new template, you should get the minimum possible file size. Save and make a note. Then compile your code and save again. This will add to the file size by some amount. It may be that compiling over and over again leaves "debris" in the file that can only be flushed by starting again. Just a suspicion, but given that a few more lines of text don't take up that much space, I think it's a reasonable one.

  8. #8
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    CodeCleaner is a great and very usefull utility. I use it for more than a year now and usually everything works out fine.
    But once in a while the resulting shrunk file appears to be not complete, some Subs missing. Not sure why. So always work with a copy of your template. And be sure to check if everything is OK before you start using the shrunk file. If not, just repeat the cleaning with another copy of the template. So far, it never happened twice in a row that the resulting file was not complete

  9. #9
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    Hi Jan, thanks for the warning, but it seems it won't be necessary - they won't let me have the code cleaner!

    Hans kindly sent it to me by email, but they intercepted the email and won't release it without putting it through virus checks and extensive testing to check it is safe to use - none of which is considered worthwhile and therefore won't be done. I've also been warned that "installing unauthorised software" is against the rules so I can't get it another way and try it, either. Security seems to have gone a bit overboard here!

    However, I did the rebuild manually (taking a blank copy of the original and transferring everything over), which after a couple of trial-and-error checks to make sure I'd got everything, reduced it to 257kb, so I'll just have to repeat that every so often - if they'd rather I waste half an hour each time doing it manually rather than check and release the software to do it automatically I suppose I'll have to go along with it!

    Interestingly, I tried the other suggested method - exporting everything, saving (a copy), then importing it all again, and it only came down to 310kb when empty, and went straight up to 450kb as soon as I reimported everything, so it seems there's much more junk in there than just the contents of the modules!

    Anyway, thanks for your help, everyone!
    Beryl M


  10. #10
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    Hi Beryl,

    I've created a Sub that does the exporting and importing of all the modules for you. I'm not in the office right now (enjoying a long weekend), so I cannot send the code snippet to you right now. But if you like, I can post it on Tuesday, when I go to work again.

  11. #11
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    Thanks, Jan, that would be a help - does it include things like autotext entries and custom document properties? Only I need to include those, too ...!

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Beryl M


  12. #12
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    Hi Beryl,

    I attached a zipped BAS file with the Subs ExportModules and ImportModules. These were embedded in a larger module, so I hope I did extract all the lines needed (and translated it correctly into English).
    And no, this BAS files does not include anything else, like AutoText entries and CustomDocumentProperties.
    Attached Files Attached Files

  13. #13
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    Thanks, Jan, I'll have a look at it when I get home tonight (I can't download anything here - see above posts).
    Beryl M


  14. #14
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bloated template (WinNT4/Word97)

    Hi Beryl,

    I gave your other requirements (AutoText, CDPs) a thought. Attached is a new version of the zipped Module1.bas. It has Subs to Save and Restore the CustomDocumentProperties of a (template) document. I suggest you use the Organiser to copy AutoText entries from one document to another. In the short period of time that I could spend on the subject, I couldn't figure out how to do that programmatically.
    (Maybe Hans can give you some pointers how to do that...)
    Attached Files Attached Files

Posting Permissions

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