Results 1 to 3 of 3
  1. #1
    sgerber
    Guest

    Document event ->

    There's got to be a way around this one... I hope.

    I'm using a combination of an AutoOpen macro and a document event to disable some menu items when a new document is opened. Here's the way I have it set up:

    Class Module called WordApplication:

    Public WithEvents App As Word.Application

    Private Sub App_DocumentChange()

    If ActiveDocument.Variables("series").Value <> "Not specified" Then
    MenuState = True
    Else: MenuState = False
    End If

    CommandBars("Menu Bar").Controls("&Script").Controls([Menu Item]).Enabled = MenuState

    End Sub

    AutoOpen macro

    Dim App As New WordApplication
    Sub MAIN()
    Set App.App = Word.Application
    End Sub

    The problem: When I close a document or exit Word, the program asks if I want to save changes to the document template. The "change," I assume, is the state of the menu item.

    How do I get it through Word's thick skull that I'm not really changing the template?

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

    Re: Document event ->

    ActiveDocument.AttachedTemplate.Saved = True

    (perhaps could be put in Document_Close event procedure in the template)

  3. #3
    sgerber
    Guest

    Re: Document event ->

    >>> ActiveDocument.AttachedTemplate.Saved = True

    (perhaps could be put in Document_Close event procedure in the template) <<<

    That did the job. Thanks, Gary.

Posting Permissions

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