Results 1 to 9 of 9
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Autoopen macro (97)

    Hi there,

    I have tried to develop a macro to automatically toggle the 'show/hide' properties to active when opening a document. The purpose of doing this is to make sure staff can see hidden text when opening a template, ie so they can see template instructions.

    Below is the macro. The macro seems to work when opening a standard document, but not when opening a template via File-New-Templates. Any help will be appreciated.

    Sub AutoOpen()
    MsgBox "The Hidden Text gives you instructions on how to complete this Document"
    ActiveWindow.ActivePane.View.ShowAll = True
    End Sub

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Autoopen macro (97)

    Hi Claude,

    An AutoOpen macro works whenever you open an existing document, not when you create one. For your purposes, I think you need turn your code into an AutoNew macro.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

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

    Re: Autoopen macro (97)

    Alternatively, double click ThisDocument in the treeview in the Visual Basic Editor, and select Document from the dropdown list in the upper left corner of the module window that appears. This will create a Document_New event procedure. Copy your code into it:

    Private Sub Document_New()
    MsgBox "The Hidden Text gives you instructions on how to complete this Document"
    ActiveWindow.ActivePane.View.ShowAll = True
    End Sub

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

    Re: Autoopen macro (97)

    .ShowAll = True makes hidden text visible alright, but many of our users don't like to see all the non-printable characters, so they click on the "q" button in the toolbar to ged rid of them. And make hidden text er, um, hidden in the process. Therefore you'd better use .ShowHiddenText = True. This makes hidden text visible even if they use the "q" button to hide the non-printable characters.

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

    Re: Autoopen macro (97)

    Claude (the original poster) can decide which version he prefers. If the users want to see the document as it will (probably) be printed, they will have to make hidden text invisible. With he original code, they can click the Show All button, with your code, they'll have to go into the Tools | Options dialog.

    Elk nadeel heb z'n voordeel

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

    Re: Autoopen macro (97)

    You're right, of course.

    Nooit gedacht hier nog eens Cruijff tegen te komen. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Autoopen macro (97)

    I created a toolbar button for my users, this toggles both ActiveDocument.ShowHidden and Options.PrintHiddenText, ensuring that the user prints what they see. This helps to prevent wasted paper, as well as making it easy for the user to toggle the display of hidden text.

    A further refinement is to toggle the state of the toolbar button and Options.PrintHiddenText in the DocumentChange event so the user can tell the current state.

    StuartR

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

    Re: Autoopen macro (97)

    Nice idea! <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  9. #9
    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: Autoopen macro (97)

    You guys are such perfectionists. I use Print Preview if I want to see how the document will look printed. <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

Posting Permissions

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