Results 1 to 12 of 12
  1. #1
    Lounger
    Join Date
    Feb 2002
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    pop up information adding to a document (Word XP/SP2)

    Dear all,

    Is it possible to add a pop up information message to a Word document? The idea, when the user opens a document it should appear a information box, which have the user to accept, before he can start using the document. I might be possible with Visual Basic.

    Regards
    Edy

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

    Re: pop up information adding to a document (Word XP/SP2)

    You can cause VBA code to be executed when the document is opened, but there are a few gotcha's:
    <UL><LI>If the user has macro security set to High, the macro will not be activated.
    <LI>If the user has macro security set to Medium (the recommended setting), a warning will be displayed that the document contains macros. This may confuse or frighten the user, and cause him/her to disable macros.[/list]I have attached a zipped document with a Document_Open event procedure in the ThisDocument object module. It displays a simple message box with an OK button when the document is opened. To see the code, press Alt+F11 (after closing the message) to activate the Visual Basic Editor. If you want to display a fancier message, you must create a userform. This is much more flexible, but also more work.
    Attached Files Attached Files

  3. #3
    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: pop up information adding to a document (Word XP/SP2)

    Depending on your application, could could have the document be a license with a hyperlink, using the hyperlink to retrieve the real document from a server. Or maybe that would be even less secure...

    How about this: you embed your document into another document, and double-clicking the embedded document constitues acceptance of your terms?

  4. #4
    Lounger
    Join Date
    Feb 2002
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: pop up information adding to a document (Word XP/SP2)

    Many thanks Hans for the attachment.

    I think, this example fits exactly our needs. Message should just inform the user what is this document for.

    The macro security is not a problem in our environment since we have set it to low anyway.

    Best regards
    Edy

  5. #5
    Lounger
    Join Date
    Feb 2002
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: pop up information adding to a document (Word XP/SP2)

    Dear Hans,

    Following to my question users are allowed to save the document with the msg box using save as. But it should be an easy way to delete the message box. I'm considering an macro. Tried the recorder, but just did record the switch to the Visual basic window and not the deletion of code in the project.

    I'm sure you can give me a hint.

    Thank you
    Edy

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

    Re: pop up information adding to a document (Word XP/SP2)

    I'm sorry, I don't understand your question. Could you try to explain again what you want to accomplish?

  7. #7
    Lounger
    Join Date
    Feb 2002
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: pop up information adding to a document (Word XP/SP2)

    Dear Hans,

    Sorry when I was not clear.

    We have added the VB codes to some Word documents, which shows the user the msg box. Those Documents are read-only and the user has the ability to save the document with save as to the harddrive. With that document the user are allowed to remove the msg box from the document. My question was, is there a way to make a macro for the user to remove the msg box with a single click instead of going to VB window and manually remove the code?

    Regards
    Edy

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

    Re: pop up information adding to a document (Word XP/SP2)

    >> to remove the msg box with a single click

    A single click on what?

  9. #9
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: pop up information adding to a document (Word XP/SP2)

    Hi Hans,

    I think what Edy is saying is that after users have opened up a read-only document with an event macro that pops up a message, she'd like the user to be able to save the document as a different name, but without including the Document_New macro. For now, she's having them open up the VB IDE and delete it that way, but that's not optimal.

    Edy, if I'm misinterpreting your query, please accept my apologies (and please clarify for the group).

    Personally, I might suggest intercepting the SaveAs command, and use the Save As dialog to capture the desired new document name, then behind the scenes create a new document, copy the contents of the current doc into it, and save it with the desired name. Done properly, it could be transparent to users and would leave out the macro.

    A more manual method would be just to save the document as RTF, which excludes macros.

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

    Re: pop up information adding to a document (Word XP/SP2)

    Thanks, Andrew.

    The document I posted earlier in this thread contained a Document_Open event procedure. Perhaps what Edy wants can be accomplished by changing this to a Document_New procedure and saving the document as a template.
    When the user creates a new document from the template, the message box is shown. When the new document is saved, it won't contain macros and the message box won't be displayed again when it is reopened.
    I have attached the template version. It can be saved in a shared folder, and users can either set their Workgroup Templates path to this folder, or double click the folder from Windows Explorer; the default action is to create a new document from the template.
    Attached Files Attached Files

  11. #11
    Lounger
    Join Date
    Feb 2002
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: pop up information adding to a document (Word XP/SP2)

    Thanks Hans,

    I will look at the document attached and yes Andrew did interpret my question well.

    Sorry when I was not clear in my initial question.

    Best regards
    Edy

  12. #12
    Lounger
    Join Date
    Feb 2002
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: pop up information adding to a document (Word XP/SP2)

    Thank you Hans,

    You helped me with your attachment. The dot file is the solution.

    Edy

Posting Permissions

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