RE: Using the dialogbox autotext in a formfield by JeanGuyMarcil
JeanGuyMarcil
Wed Sep 17 04:53:01 PDT 2008
"Mia" wrote:
> 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!