A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Setting "Bookmark" text in Text Form Field Options dialog



 
 
Thread Tools Display Modes
  #1  
Old May 24th, 2004, 08:24 PM
William Bartusek
external usenet poster
 
Posts: n/a
Default Setting "Bookmark" text in Text Form Field Options dialog

I can add a bookmark for a text field on a Word document
using the following code:

ActiveDocument.FormFields(amtIndex).Range.Bookmark s.Add _
Name:=str, _
Range:=ActiveDocument.FormFields(amtIndex).Range

Note: "amtIndex" is a defined integer

However, I can't figure out the code syntax to use that
actually enters the bookmark text in the "Bookmark:" field
in the Text Form Field Options dialog form. "Name" doesn't
work. The other fields, such as TextInput for "Default
number", in the Text Form Field Options dialog have
obvious choices as VBA code objects/data members.
  #2  
Old May 24th, 2004, 10:29 PM
Jay Freedman
external usenet poster
 
Posts: n/a
Default Setting "Bookmark" text in Text Form Field Options dialog

Hi William,

The form field already has a bookmark associated with it, so you don't need
to add one. The one you're adding is "on top of" the field, not the one
whose name is shown in the Properties dialog.

To change the name of the associated bookmark, use syntax like

ActiveDocument.FormFields(amtIndex).Name = str

There's an odd situation you can encounter in which the fields don't have a
name, and then VBA has trouble assigning one. See
http://word.mvps.org/FAQs/MacrosVBA/...ameToFmFld.htm for a workaround
for that if you need it.

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

William Bartusek wrote:
I can add a bookmark for a text field on a Word document
using the following code:

ActiveDocument.FormFields(amtIndex).Range.Bookmark s.Add _
Name:=str, _
Range:=ActiveDocument.FormFields(amtIndex).Range

Note: "amtIndex" is a defined integer

However, I can't figure out the code syntax to use that
actually enters the bookmark text in the "Bookmark:" field
in the Text Form Field Options dialog form. "Name" doesn't
work. The other fields, such as TextInput for "Default
number", in the Text Form Field Options dialog have
obvious choices as VBA code objects/data members.



  #3  
Old May 25th, 2004, 09:50 PM
William Bartusek
external usenet poster
 
Posts: n/a
Default Setting "Bookmark" text in Text Form Field Options dialog

When I used the code with .Name=str I kept getting an
error message "Method 'Name' of object 'FormField'
failed", evidently because of the "odd situation you can
encounter in which the fields don't have a
name, and then VBA has trouble assigning one." Using VBA

I was copying then pasting a FormField to create a
duplicate--therefore, the pasted FormField did not have a
name.
-----Original Message-----
Hi William,

The form field already has a bookmark associated with it,

so you don't need
to add one. The one you're adding is "on top of" the

field, not the one
whose name is shown in the Properties dialog.

To change the name of the associated bookmark, use syntax

like

ActiveDocument.FormFields(amtIndex).Name = str

There's an odd situation you can encounter in which the

fields don't have a
name, and then VBA has trouble assigning one. See
http://word.mvps.org/FAQs/MacrosVBA/...ameToFmFld.htm

for a workaround
for that if you need it.

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

William Bartusek wrote:
I can add a bookmark for a text field on a Word document
using the following code:

ActiveDocument.FormFields(amtIndex).Range.Bookmark s.Add

_
Name:=str, _
Range:=ActiveDocument.FormFields(amtIndex).Range

Note: "amtIndex" is a defined integer

However, I can't figure out the code syntax to use that
actually enters the bookmark text in the "Bookmark:"

field
in the Text Form Field Options dialog form. "Name"

doesn't
work. The other fields, such as TextInput for "Default
number", in the Text Form Field Options dialog have
obvious choices as VBA code objects/data members.



.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.