Link to home
Start Free TrialLog in
Avatar of obautista
obautista

asked on

Macro to insert a Quick Part in MS Word Document

Is it possible to create a macro that inserts a quick part on the page? For example, the shortcut key would insert the "Author" Quick Part on the page.
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

You can easily record such a macro. It would be something like this:
    ActiveDocument.AttachedTemplate.BuildingBlockEntries("Author").Insert _
        Where:=Selection.Range, RichText:=True

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of obautista
obautista

ASKER

Is it safe to assume the VBA could be saved to a Word Macro-Enabled Template (*.dotm)?  

Thanks for the tip -
Normally it is saved to Normal.dotm on your computer, so you can use it in any document (doc, docx, etc), but only on your computer
I created a custom property named IM Code.  How would I include that in VBA code?

When I go to Quick Parts > Document Property I see it there, but cannot get it to work in the VBA code.  I receive "Error! Unknown document property name".
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial