Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jan 2003
    Location
    Den Haag, Netherlands
    Posts
    208
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatic Word Macro (2002 NL)

    Good afternoon,

    First of all I hope that someone can tell me how I can easily look up things in Woody's Lounge - I think that my question is a question which may have been asked before, but I can't seem to be able to find a way to quick search...

    My second question is:
    How can I make a wordmacro autorun itself while openening the document (so I want to send my users a word-document which runs my macro when they open the document).
    I can't send them a batch file or something because of the security policies...

    Anyone?

    Many thanks in advance!
    Daphne <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

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

    Re: Automatic Word Macro (2002 NL)

    Hello Daphne,

    The search options in the Lounge have been disabled since early May because of server overload. See <!post=Temporary suspension of Search facility,250092>Temporary suspension of Search facility<!/post>.

    About the automatic macro:
    - Activate the Visual Basic Editor (Alt+F11)
    - Activate the Project Explorer (Ctrl+R)
    - Locate your document and expand it if necessary.
    - Double-click ThisDocument.
    - Create a Document_Open procedure in the ThisDocument module.

    Private Sub Document_Open()
    ' code goes here
    End Sub

    You can write code directly in this procedure, or call an existing macro.

    Warning: security policies may also prevent users from opening a document that contains a macro.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2003
    Location
    Den Haag, Netherlands
    Posts
    208
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic Word Macro (2002 NL)

    Good afternoon Hans,

    I've tried the following, but it didn't work.... what did I do wrong?

    Private Sub Document_Open()

    ' Reservekopieuit Macro
    ' Macro opgenomen op 6-10-2003 door Rietveld

    With Options
    .LocalNetworkFile = False
    .AllowFastSave = False
    .BackgroundSave = True
    .CreateBackup = False
    .SavePropertiesPrompt = False
    .SaveInterval = 10
    .SaveNormalPrompt = False
    .DisableFeaturesbyDefault = False
    End With
    With ActiveDocument
    .ReadOnlyRecommended = False
    .EmbedTrueTypeFonts = False
    .SaveFormsData = False
    .SaveSubsetFonts = False
    .DoNotEmbedSystemFonts = True
    .Password = ""
    .WritePassword = ""
    .DisableFeatures = False
    .EmbedSmartTags = True
    .SmartTagsAsXMLProps = False
    .EmbedLinguisticData = True
    End With
    Application.DefaultSaveFormat = ""

    End Sub

    I've probably done something stupid wrong, but I really can't see the trees through the forest <img src=/S/tongue.gif border=0 alt=tongue width=15 height=15> anymore.

    Many thanks in advance!
    Daphne <img src=/S/blackhole.gif border=0 alt=blackhole width=15 height=15> (<- my mind at this moment)

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

    Re: Automatic Word Macro (2002 NL)

    Hi Daphne,

    Can you describe what you want the macro to do? If you record a macro, you usually get much more code than you need, so most of the instructions in the code you posted can probably be omitted.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2003
    Location
    Den Haag, Netherlands
    Posts
    208
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic Word Macro (2002 NL)

    Hello Hans,

    What I want to happen is the following:

    I want to send an e-mail to my users with a Word document.
    This Word document has to be opened, and while opening some settings have to change automatically.
    The setting that has to be changed is:
    - Extra, Options, Save (Opslaan)
    - Options for Save - first tick 'Always make reservecopy' (altijd reservekopie maken) has to be turned off.

    Is this more clear?
    Again - many thanks!

    Daphne <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

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

    Re: Automatic Word Macro (2002 NL)

    Hello Daphne,

    The macro you need for this is very short:

    Private Sub Document_Open()
    Options.CreateBackup = False
    End Sub

    It must be in the ThisDocument module. It works for me (I performed a test).

    <big>But</big>

    What happens when the user opens the document, depends on his/her Macro Security setting:
    <UL><LI>If it is set to High, macros in the document will be disabled automatically.
    <LI>If it is set to Medium, the user will be warned that macros can be dangerous and will be given a choice to enable or disable macros.
    <LI>If it is set to Low, macros will be enabled automatically.[/list]So you can't predict whether the macro will actually be executed.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2003
    Location
    Den Haag, Netherlands
    Posts
    208
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic Word Macro (2002 NL)

    Jippeeeeeee, it works!

    I already found out about the macro security setting, I'll explain this in the mail to them. Our standard setting is Medium, so they are given the choice to enable/disable it.

    I tried to make a batch file, but that didn't work, too high a security...

    But, I think this can be a way to work it out, so again, many many thanks!

    Have a nice evening and till next time! <img src=/S/wink.gif border=0 alt=wink width=15 height=15>
    Daphne

Posting Permissions

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