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 / March 2008

Tip: Looking for answers? Try searching our database.

Bookmarks and UserForm

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt - 04 Mar 2008 17:36 GMT
Howdy.

I am trying to do something quite simple and should be able to figure this
out.  My time is tight these days, though, so I'll just hope for some help.

I am just trying to get a UserForm to populate a template in Word 2003.  I'm
following these instructions (which are supposed to be valid for W2003):

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

My problem is that when I follow all of the instructions and then try to
create a new document from my template I get the error, "The requested
member of the collection does not exist."  It fails on this code:

.Bookmarks("Text1").Range _
   .InsertBefore TextBox1

What I find is that the Bookmarks collection is empty but there are two
items in the Fields collection.

What am I missing?

FWIW, I used to be a programmer (VB 4, 5, and 6 and C#), but I never did
much VBA stuff and don't know the Office object model too well.  (Plus its
been a while.)

Thank you for any help anyone can give.

Matt
fumei - 04 Mar 2008 21:24 GMT
Please clarify: "What I find is that the Bookmarks collection is empty but
there are two
items in the Fields collection."

Where are you seeing (looking at) the Fields collection?
You did in fact make bookmarks?

>Howdy.
>
[quoted text clipped - 25 lines]
>
>Matt
Matt - 05 Mar 2008 13:42 GMT
Using the Immediate window, I checked the count in the bookmarks collection
(I'm assuming it is a collection) and the value was 0.  I did the same for
the Fields collection and the count was 2.

The word "bookmark" confuses me a bit.  What I did was follow the directions
in the page for which I provided a link and they instructed the insertion of
"Ref" fields.  That seems to be the same as a bookmark, but you are correct
to question whether my understanding of the terminology is correct--it may
not be.

Here is what my document looks like (with the field codes visible):

{ REF Text1 }
{ REF Text2 }

Interestingly (I had not noticed this before), when I open the document
*without* the field codes showing the fields display "Error! Reference
source not found."

Matt

> Please clarify: "What I find is that the Bookmarks collection is empty but
> there are two
[quoted text clipped - 34 lines]
>>
>>Matt
Doug Robbins - Word MVP - 05 Mar 2008 20:01 GMT
There is no where in that article where it talks about inserting cross
reference { REF } fields other than in the final paragraph of step 2

Create two bookmarks in your template named "Text1" and "Text2". To create
each bookmark, select a single space so that when you turn on the option to
see the bookmarks under Tools>Options>View, the bookmarks appear as []
rather than |. When you create bookmarks with a space selected like this,
the text will be inserted inside the bookmark, rather than after it.

You can then use a cross reference to the text of the bookmark if you want
the same information to appear in another location.

But, you MUST FIRST INSERT THE BOOKMARKS otherwise there is nowhere for the
code in the form to insert the information, nor is there anywhere in the
document for the cross reference field to obtain the information that it
would display

Did you insert bookmarks with the names of Text1 and Text2 into the
template.  I'll bet anything that you want that you did not because it is
the absence of those bookmarks that caused the error that you are receiving
when you use the form and also the error that you see when you toggle off
the display of the formfields.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Using the Immediate window, I checked the count in the bookmarks
> collection (I'm assuming it is a collection) and the value was 0.  I did
[quoted text clipped - 58 lines]
>>>
>>>Matt
Matt - 06 Mar 2008 00:03 GMT
Doug,

Well, there you have it.  For some reason, I thought that a REF field was
the same thing as a bookmark.  Now I see the Bookmark on the Insert menu.

I'll play with this some more.

Thank you for your help, Doug.

Matt

> There is no where in that article where it talks about inserting cross
> reference { REF } fields other than in the final paragraph of step 2
[quoted text clipped - 81 lines]
>>>>
>>>>Matt
Tony Strazzeri - 24 Mar 2008 05:36 GMT
On Mar 6, 7:01 am, "Doug Robbins - Word MVP" <d...@REMOVECAPSmvps.org>
wrote:
> There is no where in that article where it talks about inserting cross
> reference { REF } fields other than in the final paragraph of step 2
[quoted text clipped - 93 lines]
> >> Message posted via OfficeKB.com
> >>http://www.officekb.com/Uwe/Forums.aspx/word-programming/200803/1

When you insert a Word Forms Textbox fields, although they do not need
to have a bookmark name they will get a bookmark name assigned to it
automatically.  The first one inserted will be called "Text1" then
next "text2 etc.

It seems to me that you have some cross references to theses bookmarks/
fields but when copying the fields they lost their bookmark names.

The solution is to double click on the field and assign the
appropriate name Fields settings part of the "text Form Field Options"
dialog box.

Hope this helps.

Cheers!
TonyS.

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.