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?
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.
.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.Peter.
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.
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.
Sub qt()Selection.InsertAfter Text:=""""Selection.InsertBefore Text:=""""End Sub
add the following as a module;Sub AddQuoteMarks()Dim quotation As Stringquotation = Selection.TextSelection.TypeText (""" & quotation & """)End SubI'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,Regards,Simsy
not only has VoG™ beaten me to it, he also has provided a more elegant solution!Regards,Simsy
that in fact mine doesn't seem to work anyway!!!Apologies,Regards,Simsy
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.Regards,Simsy
Thank you, another minor irritant solved.
This thread is now locked and can not be replied to.
iMac Pro review
Illustrator Charles Williams on how to create magazines and book covers
Les meilleures prises CPL (2018)
© Copyright 2018 IDG UK. All Rights Reserved.