![]() |
#6
|
|||
|
|||
![]()
Thanks jjfreedman. But I think I didn't explain it correctly.
Basically, i want to be able to place the FieldCode Link Information into the datablock. I'm getting pounded with snow today, so hopefully I can do some more playing and learning in my 'down time' today ![]() Code:
Sub AddCustomBuildingBlock() Dim objTemplate As Template Dim objBB As BuildingBlock Dim objRange As Range Dim FilePath As String ' Set the template to store the building block Set objTemplate = Templates("C:\Users\paul.muldoon\AppData\Roaming\Microsoft\Word\STARTUP\Report Building Blocks.dotm") 'How Do I get his FilePath/Section of Link Field Code into the datablock instead of the text below. FilePath = "LINK Excel.SheetMacroEnabled.12 ""C:\\Data\\Samples\\Sample WP.xlsm"" ""Cover Charts!Charts_Cover_Main"" \p" Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=FilePath, PreserveFormatting:=False ' Collapse the range, set the range, and add the text Selection.Collapse Set objRange = Selection.Range objRange.Text = "Building blocks for the technically challenged" ' Add the building block to the template Set objBB = objTemplate.BuildingBlockEntries.Add( _ Name:="Title", _ Type:=wdTypeAutoText, _ Category:="General", _ Range:=objRange) End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using FieldCodes, AutoText, BuildingBlocks | ptmuldoon | Word | 5 | 01-02-2015 01:33 PM |
Auto referencing | SharkAttack | Word | 5 | 02-17-2013 07:09 PM |
Referencing | darksupernova | Word | 4 | 11-08-2012 03:37 AM |
Multiple referencing | SPRITEtoo | Word | 3 | 01-29-2012 07:39 PM |
Cross referencing | maltesedog | Word | 0 | 02-13-2009 07:43 AM |