Thread: [Solved] ASK and REF field problem
View Single Post
 
Old 05-25-2011, 11:09 PM
ilkks ilkks is offline Windows Vista Office 2007
Novice
 
Join Date: May 2011
Posts: 23
ilkks is on a distinguished road
Default ASK and REF field problem

I want to ask the document-template-user to insert his name. And then his name automaticly get copied to different places around the document.

This is working:

I have Text From Field, I double-click it and insert the name to 'Default text', and I write to bookmark field 'testBookmark'. I got { REF testBookmark } all over the document. I select the whole document and update by pressinf F9. And voilą!

This is what I want:


I want more sophisticated approach of inserting the name. For example using ASK-field that is launched by doubleclicking MacroButton. The sub of the MacroButton is:

Code:
Sub Macro3()

' Macro3 Macro
' Launch ASK-field and update the REF-fields

    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
        "ASK  testBookmark ""Write your name here"" \d First name Last name \o ", PreserveFormatting:=True
    
    Selection.WholeStory
    Selection.Fields.Update
    
End Sub
This is not working properly. It updates REF-fields, which is fine, but. First of all it asks me to write the name 2 times, and after that the MacroButton disappeares. I want to keep MacroButton alive so I can change the name if necessary.
Reply With Quote