Prev: Word Code Cleaner work with Word 2003?
Next: Problem Accessing Macro on Network Drive Using Shortcut
From: Mark on 2 Feb 2010 12:32 I am using Word 2003, I have added a formfield with code as shown below, declared the ffield as a formfield but the code is debugging with object variable not set for some reason on the '.Name'. I have successfully used this bit of code in other templates I have created. Can anyone offer me an alternative or solution please? Set ffield = _ ActiveDocument.FormFields.Add(Range:=Selection.Range, _ Type:=wdFieldFormTextInput) With ffield .Name = "contaminant" With .TextInput .Default = "Enter details" End With End With Thanks -- Mark
From: Jay Freedman on 2 Feb 2010 12:33
See http://word.mvps.org/FAQs/MacrosVBA/AssignNameToFmFld.htm -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Mark wrote: > I am using Word 2003, I have added a formfield with code as shown > below, declared the ffield as a formfield but the code is debugging > with object variable not set for some reason on the '.Name'. I have > successfully used this bit of code in other templates I have created. > Can anyone offer me an alternative or solution please? > > Set ffield = _ > ActiveDocument.FormFields.Add(Range:=Selection.Range, _ > Type:=wdFieldFormTextInput) > > With ffield > > .Name = "contaminant" > > With .TextInput > > .Default = "Enter details" > > End With > > End With > > > > Thanks |