Form Fields In Document Without Bookmarks? 
Author Message
 Form Fields In Document Without Bookmarks?

Do you have to have a bookmark in your document for any fields you want
written in the document?  I am a newbie trying to write a macro that will
open a form where I can input common letter closing information such as the
courtesy closing, enclosures, copies, etc.  Sort of like part of the letter
wizard but I don't want its layout limitations.  Anyway, is there a way to
simply dump text from a form field (text box, combo box, list box) at the
insertion point without pre-creating a bookmark?

Thanks, Ron Gaynor



Sat, 14 Aug 2004 23:53:33 GMT  
 Form Fields In Document Without Bookmarks?
Hi, Ron,

You don't need a bookmark, as long as you have some way of locating the spot where the text should
go. A bookmark is just one way of finding that spot. The insertion point (see by your code as the
Selection object) is another -- you can have something like

   Selection.InsertAfter TextBox1.Text

as long as you're 100% sure that the insertion point will be at the right spot when the userform
starts.

Yet another way -- if you want the text to appear at the end of the document, regardless of where
the insertion point is -- would be something like

   Dim myRange as Range
   Set myRange = ActiveDocument.Range
   myRange.Collapse wdCollapseEnd
   myRange.Text = TextBox1.Text

All of these methods (and more: look into inserting AutoText entries!) are possible, and the
selection of the "best" one depends on the kind of document you're creating and on how much your
intended users know about Word.

--
Regards,
Jay Freedman
Microsoft Word MVP        Word MVP FAQ site: http://www.mvps.org/word

Quote:

> Do you have to have a bookmark in your document for any fields you want
> written in the document?  I am a newbie trying to write a macro that will
> open a form where I can input common letter closing information such as the
> courtesy closing, enclosures, copies, etc.  Sort of like part of the letter
> wizard but I don't want its layout limitations.  Anyway, is there a way to
> simply dump text from a form field (text box, combo box, list box) at the
> insertion point without pre-creating a bookmark?

> Thanks, Ron Gaynor



Sun, 15 Aug 2004 01:14:44 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Putting bookmark text in document properties field

2. Using one fill-in field as a bookmark reference for rest of document

3. no valid bookmark error message, without using bookmarks at all

4. Problem when unprotecting a document with form field text fields

5. Q: VB4: Forms without titlebar, gfx without form?

6. Copy a document but without the document template

7. Document Statistics Without Opening a Document

8. Pass values from FORM fields to another page without a SUBMIT action

9. URGENT: Error when assigning long strings to Form Fields in a protected Word document

10. Maitaining form field info when unprotecting and reprotecting a document

11. Uning Form Fields and the Track Changes feature in the same document

12. Flashing Documents with FORM Fields

 

 
Powered by phpBB® Forum Software