Consulting

Results 1 to 14 of 14

Thread: Solved: Word macros that can pause for user input and then resume

  1. #1

    Solved: Word macros that can pause for user input and then resume

    I work in the legal field and I have several Wordperfect macros that help assemble documents with repetitive language. Basically, the user will start off their document from a blank page and at some point, they run the macro from the macro menu and it puts a few lines of text into their document and then pauses and prompts the user to insert their own variable text. Then the macro resumes and puts in a few more lines of text, then stopping once more to prompt the user for more variable text and then lastly, it adds a few more lines of text then quits and the user continues typing his document. Is there a way to do something similar in Word and if so, can you give me a sample? Someone has suggested using a form, but I can't use a form because most of the text in the document is created by the user and it is always different.

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You can show a form that can be used to pause the macro until the user is done doing what they need to do, then the macro can continue.

    Try the attachment.

  3. #3
    Thanks for the quick response, but what special secrets are hidden in the attachment? All I see is a blank read only document. Did I mention that I'm still trying to learn Visual Basic for Apps.

  4. #4
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    On the main toolbar click on Tools-Macro-Macro's
    Select Macro1 and then click the Run button.

    to view the code use Alt-F11
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Yeah, sorry about that. Just run the macro and it will give you an example. Then if you need help with the specific code, we can help you further.

  6. #6
    Thank you and God bless you! This is EXACTLY what I wanted and the code doesn't look too complicated. I'm crying tears of joy right now!

  7. #7
    VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Hi Chukesgirl,

    I've marked this thread as "Solved" for you - when you have the answer to a question, go to "Thread Tools" at the top of the screen to do this.

    GeekGirlau

    PS Wow - WordPerfect ... brings back memories

  8. #8
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You're Welcome

    Take Care

  9. #9
    I recently began exploriong VBA for word documents and was looking for the same solution. Do you have a sample of a work macro that accomplishes this? Any help will be appreciated

  10. #10
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,771
    Location
    Quote Originally Posted by dewachter View Post
    I recently began exploriong VBA for word documents and was looking for the same solution. Do you have a sample of a work macro that accomplishes this? Any help will be appreciated
    Since this was very old and marked [Solved], lot of times people won't read it,

    It'd probably be better to start your own stand-alone question so that more people will read it and possible offer ideas

    https://en.wiktionary.org/wiki/necropost
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  11. #11
    VBAX Regular
    Joined
    Sep 2024
    Location
    Perth, Australia
    Posts
    6
    Location
    Quote Originally Posted by Jacob Hilderbrand View Post
    You can show a form that can be used to pause the macro until the user is done doing what they need to do, then the macro can continue.

    Try the attachment.
    Hi Jacob,
    i know this is a very old post...but I can't find where to get the attachment. How do I access it please?
    Best regards,
    PeterT

  12. #12
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,217
    Location
    Sorry Peter, but due to issues in upgrading the forum software, we lost many of the early attachments.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  13. #13
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,442
    Location
    You really should start a new thread. Things have changed markedly in Word since 2006 and what you need might even be possible without macros.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  14. #14
    VBAX Regular
    Joined
    Sep 2024
    Location
    Perth, Australia
    Posts
    6
    Location
    Quote Originally Posted by macropod View Post
    You really should start a new thread. Things have changed markedly in Word since 2006 and what you need might even be possible without macros.
    Hey Paul!! So glad to see you are still monitoring posts, and that you are active! I've seen a lot of your replies when Googling for VBA help.

    Your reply is very encouraging!
    So I'll start a new thread called: "Word macro to allow the user to edit two displayed documents in the middle of complex nested Range.Find loops, and continue when finished editing."
    (I couldn't think a a way to put that more briefly without it being too generic..."

    Cheers,
    Peter

Posting Permissions

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