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 2005

Tip: Looking for answers? Try searching our database.

How do I make my form text insert at the exact bookmark location?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
duBedat68 - 18 Feb 2005 03:01 GMT
I have a template document that has a number of bookmarks throughtout it.
I have a UserForm that autoloads & requests the information.
When the User presses the SUBMIT button, the form text is supposed to be
transferred to specific BOOKMARKS in the document.
However, I find that the text is just inserted at the beginning of the
document, not at the required bookmarks.
I have previously made similar documents without any problems, but this one
seems to be giving me trouble.  I have checked the code of this one against
other working examples & all appears to be correct.

*********************************

Private Sub cmdSubmit_Click()

strInterviewDate = txtDate.Value
strInterviewTime = txtTimeCommenced.Value
strInterviewPlace = cmbPlace.Value
strInvestigator = cmbInvestigator.Value
strInterviewee = txtInterviewee.Value
strOtherPerson1 = txtOtherPerson1.Value
strOtherPerson2 = txtOtherPerson2.Value

   Selection.GoTo What = wdGoToBookmark, Name = "bmkInterviewPlace"
   Selection.TypeText Text:=strInterviewPlace

   frmROIDetails.Hide

End Sub

***********************************

Any advice would be greatly appreciated

duBe
Jezebel - 18 Feb 2005 03:20 GMT
If you're using named arguments, you have to use := to assign them -- if the
colon is missing, you're inserting a logical value instead (ie the result of
the equality); usually this just results in a runtime error, but not always,
as you've found.

To assign the value of a bookmark, set its range. Don't screw around with
Selections.

activedocument.Bookmarks("bmkInterviewPlace").Range = cmbPlace.Value

But an even better way to do this is to use DocProperties instead of
Bookmarks.

>I have a template document that has a number of bookmarks throughtout it.
> I have a UserForm that autoloads & requests the information.
[quoted text clipped - 32 lines]
>
> duBe
 
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.