macros for formatting in Word

  elgar 13:15 28 Oct 2004

I want to write a macro in MS Word to automatically insert quote marks around selected text, e.g. convert I know you are there to "I know you are there" with one click. Does anyone know how to do this?

  pj123 17:49 28 Oct 2004

Don't need to use a macro. Set it up as Autotext and all you need do is type a short name and hit F3 and there it is.

  Peter 17:55 28 Oct 2004


What about Find & Replace, i.e. Find I know you are there and Replace with "I know you are there". No need for a macro.


  Alan2 22:01 28 Oct 2004

Unless elgar comes back to say otherwise, I think he wants to be able to select "any text" then hit a key to put the double quotes around.

So a macro would be an efficient way to go about it.

  elgar 09:34 19 Feb 2005

Yeah, thanks

I forgot about this post but still searching for an answer. What I need is exactly that, I want to be able to automatically put the speech marks around any sentence I select.

  VoG II 09:53 19 Feb 2005

Sub qt()

Selection.InsertAfter Text:=""""

Selection.InsertBefore Text:=""""

End Sub

  Simsy 10:01 19 Feb 2005

add the following as a module;

Sub AddQuoteMarks()

Dim quotation As String

quotation = Selection.Text

Selection.TypeText (""" & quotation & """)

End Sub

I've done this at work using Word XP.

You have to select the text first, then run the Macro. There will probably be issues if more than 1 block of text is selected.

I hope this helps,



  Simsy 10:31 19 Feb 2005

not only has VoG™ beaten me to it, he also has provided a more elegant solution!



  Simsy 10:43 19 Feb 2005

that in fact mine doesn't seem to work anyway!!!




  Simsy 11:22 19 Feb 2005

mine does work when slightly ammended. the last line should be;

Selection.TypeText Text:="""" & quotation & """"

I got the clue from the formatting in VoG™'s posting.



  elgar 12:50 19 Feb 2005

Thank you, another minor irritant solved.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Alienware 17 R4 2017 review

These brilliant Lego posters show just what children's imaginations are capable of

Mac power user tips and hidden tricks

Comment réinitialiser votre PC, ordinateur portable ou tablette Windows ?