Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Star Lounger
    Join Date
    Jul 2001
    Location
    Edison, New Jersey, USA
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Suppress 'Save Changes to doc templ' (Word 2000)

    I have a template for my macros (it's a blank document that has only my macros associated with it). I have this template attached to some documents. When I open one of these documents, the macros force an immediate SaveAs to a specific location (depending on just which document was opened) using a specific name. When the user clicks the Save button, Word responds with

    "Do you also want to save changes to the document template?"

    I have no idea what changes Word is considering save to the template file. I feel I do not want any changes saved to the template file. But then again, I don't know what changes it thinks it sees.

    My questions are: Should I feel safe just suppressing the "Do you also want to save..." prompt? If so, what is the recommended approach? Turn off a flag that says there were changes or something else?

    TIA

  2. #2
    Lounger
    Join Date
    Nov 2001
    Location
    SF Bay Area
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    I am curious why you are basing documents on the template at all. If the template is just a blank document with only macros, then I would recommend putting it in your startup folder, which would make the macros available globally. If there are formatting settings you want to use, you could create a new template with those settings and call it "blank" or some such thing.

    Christie

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Hi Rob:
    I agree with Christie, but I'm writing to say that the change might be caused by one of the macros. If any of your macros are AutoXXXX, this could cause the behavior you describe. I understand your concern, because a macro virus can also cause changes, so it's nice to know why & not just ignore it.

    On the other hand, if this template is attached to documents because you only need these macros for some documents, but don't want it to load all the time, you can either attach it, as you have, or just access it through Tools/Templates & Add-ins.

  4. #4
    New Lounger
    Join Date
    Jul 2001
    Location
    NH/MA, Massachusetts, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Rob

    You can use a macro called autoclose that will run just prior to the template closing. In that macro put the line template.saved = true (something like that).

    That set the dirty flag on the template to false cause word to think that no changes have been made that are not saved.

    Sean

  5. #5
    Star Lounger
    Join Date
    Jul 2001
    Location
    Edison, New Jersey, USA
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Christie and Phil,

    Here's the scoop (simplified as much as possible):

    My loan origination software supports a process in which data from a loan file can be exported to Word. The process then opens Word (fails if Word is already open - haven't looked into this yet) and a specific Word document. That Word document must be a MailMerge Main document with the exported data being placed into the data document that is then merged with the main document.

    The problem I am solving with macros is that I am trying to protect the opened document from changes that my folks then make in finalizing the doc. The protection methods normally available with Word are inconsistent with this scenario (e.g., can't have the doc write protected and still open it as a Mail Merge Main being populated with the data doc).

    Therefore, I created a group of macros to control Open, Close, Save, SaveAs, and Exit functions for these several documents that we use.

    These macros are in a blank template because I am controling the same functions across a set of different documents with their own formatting set within each of them (i.e, these macros are not to control formatting).

    I do not want these warped functions to be globally available - quite the opposite - as isolated as possible.

    Phil, none of the marcos is specifically named an AUTOxxxx.

    My tests show that replying Cancel to the prompt creates no adverse affects, so I am now going to look into suppressing the prompt altogether.

    Thanks again for your replies.

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    You need to look at the macro code to find out what it is doing.

    THe requirement to save be the right thing to do, or it may be a result of sloppy macro programming.

  7. #7
    Star Lounger
    Join Date
    Jul 2001
    Location
    Edison, New Jersey, USA
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Sean,

    Your suggestion is the line of thought I am going to pursue. I'm just not sure of the 'best' way considering my limited knowledge in this area.

    Given that the Open macro is doing nothing but forcing a SaveAs, what is happening behind the scenes that causes Word to issue the prompt on the attached template? (I.e., what changes were made to the template? - none that I can see).

    So, I think I want to put 'some where' a statement of 'some sort' to make Word think there are no changes. Your idea of making Word think that any changes have already been saved is very consistent with my goal (and might even be the 'best').

    And that is precisely my question. What is the best approach? I am hoping that someone will either 'second' your suggestion or offer an alternative to consider.

    Thanks very much for your suggestion.

  8. #8
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    If you clean up the macro code, you can avoid the prompts.

    A document can have only 1 templated attached.
    If you wish to use macros that are not in the attached template, then the only safeway is to include the macros in a global template, or include them in the Normal template.

    When you attach th blank template to use the macros, you need to remember to re-attach the original template. And, if the macros rely on, say, styles and autotext in the original template, you may run into problems by attaching the blank template.

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    I'll second, or third, the suggestion.
    But to do this properly, one needs to understand the macro code.

    Setting the SAved property without understanding the macro code is not recommended, so I'll withdraw my second (third), unless you do first understand the macro code.

    If you need help, I started an as yet unannounced service in August to mentor others in such situations.
    If interested, lemme know via email.

  10. #10
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Hi Rob:
    I'm sorry I was unclear. I didn't mean specifically AutoXXXX--I was referring to AutoExec, AutoOpen, AutoNew, & AutoClose. However, I only meant that you should look at the macro code to see if your template is being changed...& while I would look at the auto macros first, any one can cause a change. What you might do, depending upon the length of the code in your macros, is to post the code on the VBA board & see if anyone can tell you what is causing your template to change.

    Incidentally, there are other things that can cause it besides macros you've written. It may be that you have an add-in that is causing changes.

  11. #11
    Star Lounger
    Join Date
    Jul 2001
    Location
    Edison, New Jersey, USA
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Howard, Thanks for your insight. I may be emailing you later because, while no dummy, I have very limited experience with VB, Macros, VBA, etc. In fact, these macros are my only experience! So while I think I understand what my macros are doing, I realize I may only understand on one level. My other experience with software suggests to me that I only see a couple layers of this particular onion.

    Thanks again for the direction. I will review the link you provided too.

  12. #12
    Star Lounger
    Join Date
    Jul 2001
    Location
    Edison, New Jersey, USA
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Phil,

    I did understand what you meant by Autoxxx. I just wanted to specify that I do not use Auto_naming because I am unsure of the scope implied in such a name (if any).

    I am doing things in my Macros like:

    ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle

    So I know I am affecting the Active Document, but that does not mean that I am affecting the template on which the document is based. This view is based on a lack of specific VBA experience and may be inaccurate.

    As for posting the macro template: There is something else that has been bothering me. The size of this .dot document is 7,591kb. When I look at the approximately 15 screens of code, I think 7,591kb is much too large a number. Right or wrong it is much larger than the 100k max for posting. Perhaps I could create a scaled down version to test with...

    Add-ins: I do have the Office In Color addin, OIC Start.dot. and an unknown, _CSO.dot. I will uncheck them and see what happens.

    Thanks for the insight and ideas.

  13. #13
    Star Lounger
    Join Date
    Jul 2001
    Location
    Edison, New Jersey, USA
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Just an update. Removing the check marks from the 2 add-ins did not change anything that I can see. They are probably just a hold-over from when I started my learning curve and are not needed at all. I will get rid of them in all my macros just to make them cleaner.

  14. #14
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    The circumstantial evidence is that a macro is not properly cleaning up after itself.

    Sometimes it's easy to fix such a problem, other times difficult.

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

    Re: Suppress 'Save Changes to doc templ' (Word 2000)

    Rob,

    The posts on this thread to date illustrate that it's really hard to troubleshoot code, if you can't see the code!

    There's no way that your template should be 7.5MB if all it contains is a couple of pages of code - that's either a really bad case of code bloat or something is marginally corrupted in that template. In either case I'd be wanting to clean that up first 'cause a 7.5 MB template is a drag on everything:

    In the VB Editor, export the code module(s) in your template, and save them to another location.

    Then create a new blank document, go to the VB Editor, and import these code modules into the new document (you can also use drag and drop in the VB Editor to accomplish this). Make this document your new template.

    It will probably then be less than 100 KB. Then post it here.

    Gary

Page 1 of 2 12 LastLast

Posting Permissions

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