G
Graham Scott
Hi,
This is my first stab at a VBA form, and I am having some trouble trying to
create AutoTextEntries from data entered in the form.
I have a template with a form. When the user attempts to create a document
from the template, I want to display a form for the user to enter some data
(name, phone, e-mail, course number, etc). When the form is dismissed, I
validate the data entered, and put it into Document Variables, for display
in the header, AND I also want to put some items into AutoText entries in
the template, so that (a) they can be easily used elsewhere in the text, and
(b) next time the user creates a document from the template, I can use those
AutoText entries to pre-load the form.
So the process is basically:
- Display the form, preloading with previously used values where possible.
- After the user hits OK, in Sub Document_New(), retrieve the values from
the form fields, load them into Document Variables, and create / update
AutoText Entries.
I retrieve the values from the form TextBoxes into String variables, but
'AutoTextEntries. Add' will not accept a String value for the Range
parameter, and I can't quite get my head around exactly what I am supposed
to give it for Range. I don't find the help very helpful on this - the Range
is supposed to be a Range of text from the document, yes? I don't see how I
am to manage that, unless I can somehow tell it to use the contents of the
Document Variable which I have set up, but that doesn't seem to work either.
Very confused! Any help will be much appreciated!
GRS
This is my first stab at a VBA form, and I am having some trouble trying to
create AutoTextEntries from data entered in the form.
I have a template with a form. When the user attempts to create a document
from the template, I want to display a form for the user to enter some data
(name, phone, e-mail, course number, etc). When the form is dismissed, I
validate the data entered, and put it into Document Variables, for display
in the header, AND I also want to put some items into AutoText entries in
the template, so that (a) they can be easily used elsewhere in the text, and
(b) next time the user creates a document from the template, I can use those
AutoText entries to pre-load the form.
So the process is basically:
- Display the form, preloading with previously used values where possible.
- After the user hits OK, in Sub Document_New(), retrieve the values from
the form fields, load them into Document Variables, and create / update
AutoText Entries.
I retrieve the values from the form TextBoxes into String variables, but
'AutoTextEntries. Add' will not accept a String value for the Range
parameter, and I can't quite get my head around exactly what I am supposed
to give it for Range. I don't find the help very helpful on this - the Range
is supposed to be a Range of text from the document, yes? I don't see how I
am to manage that, unless I can somehow tell it to use the contents of the
Document Variable which I have set up, but that doesn't seem to work either.
Very confused! Any help will be much appreciated!
GRS