Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2006

Tip: Looking for answers? Try searching our database.

Set insertion point in Document from UserForm

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sabtve - 28 Feb 2006 18:48 GMT
Hello.
I have created a Document template (a letter) in Word2003, using the eminent
guidance found in "How to create a Userform" (Many thanks, Doug. Really got
me started).
And it works beautifully, apart from the fact that after the data from the
UserForm are inserted into respective Bookmarked fields in the Document, the
insertion point is at the top of the Document, and not where I have
specified "Write your letter here...".
And being a novice, I have not been able to find how to place the cursor
automatically (progammed) in the right field (macro?). So I have to resort
to you. Probably trivial, but I give up.

Second q.: I have tried to write vb code behind the "zip" field (TextBox1)
on the form, to
                validate keyed inn fields (max no. of digits, all numbers
aso)..
                The code is ok and shows error MsgBox and all, but this
happens after the 1.                         digit in the field is keyed in.
I want it to check after the whole field is filled in.
               Other fields (name, address) will be checked for blanks and
so on.
               The reason is probably in the TextBox1.Changed event, but I
don't understand what                 to do.
               Hva also tried to put the code behind the "Transfer to
letter" button instead, to test                     the fields in afterhand,
but that didn't work much good at all.
               Best thing would be to test the fields as they are filled
in.
               Any tips here? Pretty stuck now.

Sincerely
Tom V. Ekvoll
Oslo, Norway
Charles Kenyon - 28 Feb 2006 19:04 GMT
You can use bookmarks to tell your userform where you want things, including
the insertion point when it is closed. On the other hand, I use styles
rather than bookmarks for many of my insertion points. I use one style for
the date line, a different style for the initial line of the inside address,
a third for the continuation lines, a different one for the reference line,
for the greeting, and for the body of the letter. I do this because these
styles are very handy when creating continuation headers/footers. You use a
StyleRef field to pick up these bits of information. You can have your
userform's closing procedure search for the first instance of the body text
style if you want. I have a macrobutton field with the display [Type letter
here.] and have my procedure select that field. Lots of options available.

Actually, I have my letter template set up with lots of macrobutton fields.
My Userform puts things in those fields (replacing the fields). If the user
cancels the UserForm, the macrobutton fields are there in the document as
prompts and can be reached easily with the F11 key.

See http://www.addbalance.com/usersguide/fields.htm#MacroButton and
http://www.mvps.org/word/FAQs/TblsFldsFms/UsingMacroButton.htm for more
about macrobutton fields.

Take a look at: How to set up letterhead or some other document where you
want one header on the first page and a different header on other pages.
http://www.addbalance.com/word/headersfooters.htm This gives step-by-step
instructions. (It also has the following links)

Some other pages to look at:

Letterhead Tips and Instructions
http://sbarnhill.mvps.org/WordFAQs/Letterhead.htm

Letterhead Textboxes and Styles tutorial
http://addbalance.com/word/download.htm#LetterheadTextboxesAndStylesTutorial

Template Basics
http://www.addbalance.com/usersguide/templates.htm

How to Create a Template - Part 2 - essential reading
http://www.mvps.org/word/FAQs/Customization/CreateATemplatePart2.htm

Word "Forms"
http://www.addbalance.com/word/wordwebresources.htm#Forms and

Word for Word Perfect Users
http://www.addbalance.com/word/wordperfect.htm if you are coming from a WP
environment (or even if you are not).

Hope this helps,
Signature


Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Hello.
> I have created a Document template (a letter) in Word2003, using the
[quoted text clipped - 29 lines]
> Tom V. Ekvoll
> Oslo, Norway
sabtve - 28 Feb 2006 19:19 GMT
Thank you for a very prompt answer.
Evidenltly, a lot of study is a head of me. But this is fun, even if
frustrating.

Thanks again
Tom

> You can use bookmarks to tell your userform where you want things,
> including the insertion point when it is closed. On the other hand, I use
[quoted text clipped - 78 lines]
>> Tom V. Ekvoll
>> Oslo, Norway

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.