![]() |
|
#1
|
|||
|
|||
![]()
Um, not like that!
![]() I guess you know that you can't just type braces around a field code in a document, because that doesn't make a working field. You have to use Ctrl+F9 or the Insert > Quick Parts > Field dialog. Similarly, in VBA you can't just assign a string to make a field. You must use the ActiveDocument.Fields.Add method, passing it parameters that say where to put it and what kind of field it will be. For example, to insert an {AUTHOR} field at the current insertion point, you would write Code:
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldAuthor Code:
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldIncludeText, _ Text:=Chr(34) & "D:\\Documents\\eq.docx" & Chr(34), PreserveFormatting:=False |
![]() |
|
![]() |
||||
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 |