P
PiaD
Hi -
I have a macro that inserts 2 ASK fields at the top of an active document as
follows:
I would like to first look for the ASK fields first, and only add them if
they do not exist yet. Can someone help with the IF statement needed?
Sub AddFieldCodes()
' Used to add ASK field codes to an existing document, not initially created
using this template.
' Add ASK Reference Field Codes at start of document.
Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Name:=""
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
" ASK Name ""Name"" \d ""<Name>"" ", _
PreserveFormatting:=False
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
" ASK Type ""Type"" \d ""<Type>"" ", _
PreserveFormatting:=False
End Sub
I have a macro that inserts 2 ASK fields at the top of an active document as
follows:
I would like to first look for the ASK fields first, and only add them if
they do not exist yet. Can someone help with the IF statement needed?
Sub AddFieldCodes()
' Used to add ASK field codes to an existing document, not initially created
using this template.
' Add ASK Reference Field Codes at start of document.
Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Name:=""
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
" ASK Name ""Name"" \d ""<Name>"" ", _
PreserveFormatting:=False
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
" ASK Type ""Type"" \d ""<Type>"" ", _
PreserveFormatting:=False
End Sub