Tom Crowfoot
asked on
Word 2010 Form - pop up questions
Dear Experts
I am trying to create a word document which users fill in when its opened - basically the document is our standard terms of business which requires a few fields filled in (such as client name, salesman's name, a date etc)
So when a user opens the document I want a pop up box to appear where the user answers a few questions (client name, salesman's name, a date etc). Once they have done this the fields are updated with their answers and the document is done!.
I have put in the content controls but cannot seem to find a way of setting up the pop up box & getting it to fill out the details
Can anyone help -I'm a bit basic on Word!
I am trying to create a word document which users fill in when its opened - basically the document is our standard terms of business which requires a few fields filled in (such as client name, salesman's name, a date etc)
So when a user opens the document I want a pop up box to appear where the user answers a few questions (client name, salesman's name, a date etc). Once they have done this the fields are updated with their answers and the document is done!.
I have put in the content controls but cannot seem to find a way of setting up the pop up box & getting it to fill out the details
Can anyone help -I'm a bit basic on Word!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can change each Content Control's static prompt in Design Mode.
Otherwise you could employ some VBA.
The simplest would be a series of InputBox statements, but unless there are a very few, that could get unwieldy and likely to annoy anyone trying to use it. The code would go into a code module in the document's template.
The code would be called from the Document_New and the Document_Open Subs in the ThisDocument module of the template.
Otherwise you could employ some VBA.
The simplest would be a series of InputBox statements, but unless there are a very few, that could get unwieldy and likely to annoy anyone trying to use it. The code would go into a code module in the document's template.
Sub InputBoxes()
Dim strText As String
strText = InputBox("First Name")
FillCC strText, "FirstName", ActiveDocument
strText = InputBox("Last Name")
FillCC strText, "LastName", ActiveDocument
End Sub
Sub FillCC(strText As String, strTag As String, doc As Document)
Dim ccs As ContentControls
Set ccs = doc.SelectContentControlsByTag(strTag)
ccs(1).Range.Text = strText
End Sub
The code would be called from the Document_New and the Document_Open Subs in the ThisDocument module of the template.
Private Sub Document_New()
InputBoxes
End Sub
Private Sub Document_Open()
InputBoxes
End Sub
You need
Enter_Details.Show to open a UserForm
DoCmd is not meaningful in Word
Enter_Details.Show to open a UserForm
DoCmd is not meaningful in Word
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much for your help on this - works perfectly
ASKER
I have built the basis of the form & called it "Enter_Details", but cannot seem to get it to open
Open in new window
Also I have no real idea how the data gets from the form into the document?
Can you help?