Share via

Macros: a macro to auto-replace a text string?

Anonymous
2010-07-17T19:58:37+00:00

Hello all,

I'm writing a document that repeatedly uses the same sentences over and over again.  The text string I need is too long to use Auto-Replace, and there are enough variations that I'm not interested in trying to have a hotkey combination for every one of them.  Is there a way to create a macro that will basically do the same thing?  i.e. that will insert a long sentence/paragraph of text in response to inserting a short unique set of characters (e.g. test123)?

Thanks,

Rob

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2010-07-18T04:40:31+00:00

    Why not use autocorrect? Autocorrect will insert anything that can be included in a document - including strings of text several pages long. You can use any unique string as a trigger including 'test123'

    <robbyvegas78> wrote in message news:*** Email address is removed for privacy ***...

    Hello all,

    I'm writing a document that repeatedly uses the same sentences over and over again.  The text string I need is too long to use Auto-Replace, and there are enough variations that I'm not interested in trying to have a hotkey combination for every one of them.  Is there a way to create a macro that will basically do the same thing?  i.e. that will insert a long sentence/paragraph of text in response to inserting a short unique set of characters (e.g. test123)?

    Thanks,

    Rob


    Graham Mayor - Word MVP

    www.gmayor.com

    Posted via the Communities Bridge

    http://communitybridge.codeplex.com/

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-07-18T01:27:17+00:00

    This is the kind of thing that Autohotkey is good at.


    Andrew - www.stoptyping.co.uk

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-07-17T20:06:56+00:00

    You could save the long text as indiviual files (e.g., test123.doc) and

    insert them at the selection using:

    Sub ScratchMaco()

    Dim pStr As String

    Dim oRng As Word.Range

    Set oRng = Selection.Range

    pStr = InputBox("Enter string name") 'e.g., test123

    oRng.InsertFile ("C:" & pStr & ".doc")

    End Sub

    <robbyvegas78> wrote in message

    news:*** Email address is removed for privacy ***...

    > Hello all,

    >

    > I'm writing a document that repeatedly uses the same sentences over and

    > over again.  The text string I need is too long to use Auto-Replace, and

    > there are enough variations that I'm not interested in trying to have a

    > hotkey combination for every one of them.  Is there a way to create a

    > macro that will basically do the same thing?  i.e. that will insert a long

    > sentence/paragraph of text in response to inserting a short unique set of

    > characters (e.g. test123)?

    >

    > Thanks,

    >

    > Rob

    >


    Greg Maxey Visit my website at: http://gregmaxey.mvps.org/word\_tips.htm

    Was this answer helpful?

    0 comments No comments