Using the dialogbox autotext in a formfield

M

Mia

Hi!

I need help to create VBA for this:
I have several formfields in my document and offcourse the document is
protected.
I want the dialogbox "insert autotext" to appear in one of my fields, then I
shall be able to choose one of the autotexts and insert it in the formfield.

Please help
 
J

Jean-Guy Marcil

Mia said:
Hi!

I need help to create VBA for this:
I have several formfields in my document and offcourse the document is
protected.
I want the dialogbox "insert autotext" to appear in one of my fields, then I
shall be able to choose one of the autotexts and insert it in the formfield.

This is no small order!

AutoText entries are not available when the document is locked for forms.

So, to make this work, and preserve the formfield content at the cursor
location, you willl need more involved code than you can imagine.

You would need to:

Save current cursor location
Unlock the form
Get a dialog box displayed so user can select an AutoText
Insert the AutoText at the end of the document
Cut the range just inserted
Lock the form
Reset cursor to original location
Paste range that was cut

Note that any formatting will be lost.

There maybe an easier way, but right now this is the best I can think of!
 

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