Quick Quotes macros for Word

“For me and, I am sure, many other writer, quotes are a time consuming nuisance. It would be nice to be able to select text and hit shift ‘ or shift ” to have the selection put in quotes and properly formatted. I have never seen an app with a feature like this, but I think it would be very popular. ” –  Jim MacG

A great idea and it gave Peter something to do on his long flight to Kathmandu.

Here’s two very simple Quotes macros that you can adapt to suit.

AddQuotefromClipboard()

Is for a quote you’ve copied to the clipboard ready for pasting into a Word document.

It inserts a quote mark to the start then pastes in the clipboard contents and finally inserts another quote mark.

The whole lot can be formatted with italics or a specific style.

AddQuotetoSelection()

This code works for a quote you already have in the document.  Select the quoted text then run the macro.

It adds quote marks to the start and end of your selection.

The whole lot can be formatted with italics or a specific style.

 

These are just simple examples to get you started. The VBA has no error trapping (for example if there’s nothing in the clipboard or no selection).  No test to see if quote marks are already present in the clipboard or selection.

 

Christine M makes a good point — the code doesn’t add ‘smart quotes’.  To do that replace the “”””  with Chr(147) (open) or Chr(148) (close).

 

Sub AddQuotefromClipboard()

'

' Inserts the current clipboard selection

' with quote marks before and after

' Formatting is set to Italics

'

' a deliberately simple macro

' there are probably/certainly more elegant solutions

'

' change the formatting in each With statement to suit

'

' Adds double-quote marks to start and end of current selection

' Change the """"  to  "'"  if you want single quote marks.

Windows 10 from people 'in the know'

A detailed and independent look at Windows 10, especially written for the many people who use Microsoft Office.

Fully up-to-date with coverage of the Anniversary 2016 major update of Windows 10.

This 670 page book shows you important features and details for all serious Windows 10 users.

' Change the """"  to  Chr(147) or Chr(148)  if you want smart quotes.

 

    With Selection

       .Font.Italic = True

   ' Option - apply a style instead

   '    .Style = ActiveDocument.Styles("Quotes")

    End With

    Selection.TypeText Text:=""""

       

    With Selection

       .Font.Italic = True

       .PasteAndFormat (wdFormatPlainText)

    End With

   

    With Selection

       .Font.Italic = True

    End With

    Selection.TypeText Text:=""""

End Sub

 

Sub AddQuotestoSelection()

'

' AddQuotestoSelection Macro

'

' Adds double-quote marks to start and end of current selection

' Change the """"  to  "'"  if you want single quote marks.

' Change the """"  to  Chr(147) or Chr(148)  if you want smart quotes.

 

Selection.InsertBefore """"

Selection.InsertAfter """"

 

' optional - change quote to a specific style

' change the style name to an available style in your document/template!

' Selection.Style = ActiveDocument.Styles("Quotes")

 

' or, make the selection into Italics

 Selection.Font.Italic

   

End Sub