word vba - How do I insert a QuickParts BuildingBlock in an Outlook appointment using VBA? -
i have quickparts building block in microsoft outlook 2016 called "meeting purpose block." can use navigating through ribbon, cannot figure out how write vba, i.e., macro, same thing.
from can tell, building block part of microsoft word template named "normalemail.dotm", assume have use word vba library in code.
you need add reference word tlb or change word.* variables variant
sub insertbuildingblock() dim oinspector inspector dim odoc word.document dim wordapp word.application dim otemplate word.template dim obuildingblock word.buildingblock ''or inspector other way set oinspector = application.activeinspector if oinspector.editortype = oleditorword ''the property wordeditor word.document set odoc = oinspector.wordeditor ''this inserts firt building block in first template ''this based on simple recording action in word set wordapp = odoc.application set otemplate = wordapp.templates(1) set obuildingblock = otemplate.buildingblockentries(1) obuildingblock.insert wordapp.selection.range, true end if end sub
Comments
Post a Comment