How to create dialog boxes to populate fields in MS Word

P

Paresh Pandya

Hi all,

I want to create a simple form where a user can enter
information (i.e phone number) which will then populate
fields (i.e. anyplace where there is <phone> written)
found through a document. is this possible? if so how do
i go about setting it up?

Thank you for your help.
 
G

Guest

Hi Jay,

That is EXACTLY what I was looking for. my next question
is how do i embed this in way so that if i distribute just
the word doc (.doc file) i still have a form that i can
use to fill in values?

Next question:
 
D

Doug Robbins - Word MVP

Hi Paresh,

You should distribute the template or make it available to your users.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
P

Paresh Pandya

Hello,

I have a few questions I hope someone can answer.

1. Once I have developed the .dot file if I send that to
the end users the only way they can run the user front end
is by creating a new document and selecting that as a
template. is there a way to do a regular 'file->open' on
the dot file and still have the user front end
functionality?

2. probably linked with question 1, is there a way to
embed a button in the document that will launch the user
form, and once filled will populate the document?

3. the values that are filled in the bookmarks come in
plain. is there a way for the vb code to fill in values in
bold?

4. what is the difference between InsertAfter and
InsertBefore?

thanks!
 
D

Doug Robbins - Word MVP

Hi Paresh,

1. You could name the macro autoopen and then it would run when the
template/document is opened BUT your users would then get a macro virus
warning if their security level is set to Medium. If it's set to high, the
macros just won't run. Therefore, it's better for them to save the macro
into the templates folder and use File>New

2. Yes, but I would advocate doing what I have suggested in 1 instead.

3. You can format the bookmarks as Bold, but for more control, instead of
writing the values to bookmarks, use

ActiveDocument.Variables("varname").Value = TextBox1

and in the document insert a docvariable field to which you add the \*
Charformat switch and apply the desired formatting to the D of DOCVARIABLE

{ DOCVARIABLE "varname" \* charformat }

and include code in the userform to update the fields in the document

4 If you insert the bookmarks so that they enclose a space, .InsertBefore
will insert the text inside the bookmark so that you can then use a cross
reference to the text of the bookmark. .InsertAfter inserts the text after
i.e. outside the bookmark. As a result a cross reference to the text of the
bookmark will not return the data that is inserted.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
C

Chad Knudson

In regards to #1, what I do is in an AutoOpen macro I check to see if the
document is actually a template and if it is, I create a new document based
on that template, close the template file, and activate the new document.
That way if someone opens my template intending to "run" the template,
they'll get the experience they were intending.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top