PC Review


Reply
Thread Tools Rate Thread

Bookmarks 101

 
 
Lenny
Guest
Posts: n/a
 
      16th Oct 2009
Can someone provide a good source for in-depth information on Bookmarks....
Word help pretty much only covers how or where to insert.

I need to find out if there is a character limit for bookmarks inserted into
a text form field under the 'text form field options'. Also in a current
project, I am working with a group that unlocks a protected form template to
allow for the pulling in of information from an Access database. They have
added their own bookmarks over top of the form field and I am trying to
ascertain whether this is causing some of theh problems they are having.
When I press F5 and select bookmarks, I can see that some of the form fields
are showing two bookmarks (different names) and that other bookmarks in the
form fields are not showing up in the list at all.

Can someone explain a bit more about bookmarks or refer me to a source? My
thanks and regards for all the help the mvp's have provided over the years.

Lenny
 
Reply With Quote
 
 
 
 
macropod
Guest
Posts: n/a
 
      16th Oct 2009
Hi Lenny,

Bookmarks can be discrete, overlapped or embedded (ie one within another). Formfields can have a bookmark, but they don't have to -
they are assigned one by default but. if you copy & paste a formfield, the copy doesn't get a bookmark.

Text formfields can have as much text as you like, but inputting more than 255 characters into one programmatically isn't as
straightforward as inserting shorter strings. Microsoft provides a workaround at:
http://support.microsoft.com/default...b;en-us;163192
Here’s a simpler way:
ActiveDocument.Bookmarks("Name").Range.Fields(1).Result.Text = "My really long string"
Thus:
Sub UpdateFormField(FFName As String, FFText As String)
Dim StrPwd As String, bProt As Boolean
StrPwd = "YourPassword"
StrPwd = ""
With ActiveDocument
If .ProtectionType = wdAllowOnlyFormFields Then
bProt = True
.Unprotect Password:=StrPwd
End If
.Bookmarks(FFName).Range.Fields(1).Result.Text = FFText
If bProt = True Then .Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True, Password:=StrPwd
bProt = False
End With
End Sub
where the calling routine passes both the formfield's name (FFName) and content (FFText) as parameters. For example:
Sub Demo()
UpdateFormField "Text1", "My really long string"
End Sub

If you're populating bookmarks programmatically, it's generally not a good idea to do that with a bookmark that overlaps another on,
or has formfields or bookmarks embedded in it, because of the risk of destroying those objects. Some code for programmatically
updating bookmarks (in an unprotected document) is:
Sub UpdateBookmark (BmkNm as string, NewTxt as string)
Dim BmkRng as Range
With ActiveDocument
If.Bookmarks.Exists(BmkNm) Then
Set BmkRng =.Bookmarks(BmkNm).Range
BmkRng.Text = NewTxt
.Bookmarks.Add BmkNm, BmkRng
End if
End With
Set BmkRng = Nothing
End Sub
where the calling routine passes both the bookmark name (BmkNm) and its new contents (NewTxt) as parameters.

--
Cheers
macropod
[Microsoft MVP - Word]


"Lenny" <(E-Mail Removed)> wrote in message news:6D23B925-E278-4087-AC6B-(E-Mail Removed)...
> Can someone provide a good source for in-depth information on Bookmarks....
> Word help pretty much only covers how or where to insert.
>
> I need to find out if there is a character limit for bookmarks inserted into
> a text form field under the 'text form field options'. Also in a current
> project, I am working with a group that unlocks a protected form template to
> allow for the pulling in of information from an Access database. They have
> added their own bookmarks over top of the form field and I am trying to
> ascertain whether this is causing some of theh problems they are having.
> When I press F5 and select bookmarks, I can see that some of the form fields
> are showing two bookmarks (different names) and that other bookmarks in the
> form fields are not showing up in the list at all.
>
> Can someone explain a bit more about bookmarks or refer me to a source? My
> thanks and regards for all the help the mvp's have provided over the years.
>
> Lenny


 
Reply With Quote
 
macropod
Guest
Posts: n/a
 
      16th Oct 2009
Oops - delete the line:
StrPwd = ""

--
Cheers
macropod
[Microsoft MVP - Word]


"Lenny" <(E-Mail Removed)> wrote in message news:6D23B925-E278-4087-AC6B-(E-Mail Removed)...
> Can someone provide a good source for in-depth information on Bookmarks....
> Word help pretty much only covers how or where to insert.
>
> I need to find out if there is a character limit for bookmarks inserted into
> a text form field under the 'text form field options'. Also in a current
> project, I am working with a group that unlocks a protected form template to
> allow for the pulling in of information from an Access database. They have
> added their own bookmarks over top of the form field and I am trying to
> ascertain whether this is causing some of theh problems they are having.
> When I press F5 and select bookmarks, I can see that some of the form fields
> are showing two bookmarks (different names) and that other bookmarks in the
> form fields are not showing up in the list at all.
>
> Can someone explain a bit more about bookmarks or refer me to a source? My
> thanks and regards for all the help the mvp's have provided over the years.
>
> Lenny

 
Reply With Quote
 
Jay Freedman
Guest
Posts: n/a
 
      16th Oct 2009
Hi Lenny,

I don't know of any comprehensive writeup of bookmarks, especially in
the unusual circumstances you describe. But there is a lot of ad-hoc
knowledge of their behavior from (sometimes painful) experience.

According to http://support.microsoft.com/?kbid=211489 -- always a
good source for information about "how many" -- a bookmark name can be
up to 40 characters.

Bookmarks of any kind are allowed to overlap or cover the same area.
If problems are occurring because extra bookmarks are applied over
form fields, most likely the problems really result from references to
the wrong bookmarks rather than from the simple fact of there being
two in the same place.

If you want a macro to put text into a form field, it has to refer to
the bookmark name that appears in the field's Properties dialog.
Referring to some other bookmark that covers the same area may have
one of two undesireable effects:

- If the form is unprotected, the inserted text may delete the form
field (the same as overwriting any other text) or it may put the text
before or after the form field, depending on exactly what the macro
code is.

- If the form is still protected, the macro will probably halt with
an error because it's trying to insert the text into a protected area.

If instead the macro code does the proper thing and sets the result of
the form field (using the correct bookmark name from the Properties
dialog to identify the form field), then it is wrong to unprotect the
form first.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Fri, 16 Oct 2009 08:32:01 -0700, Lenny
<(E-Mail Removed)> wrote:

>Can someone provide a good source for in-depth information on Bookmarks....
>Word help pretty much only covers how or where to insert.
>
>I need to find out if there is a character limit for bookmarks inserted into
>a text form field under the 'text form field options'. Also in a current
>project, I am working with a group that unlocks a protected form template to
>allow for the pulling in of information from an Access database. They have
>added their own bookmarks over top of the form field and I am trying to
>ascertain whether this is causing some of theh problems they are having.
>When I press F5 and select bookmarks, I can see that some of the form fields
>are showing two bookmarks (different names) and that other bookmarks in the
>form fields are not showing up in the list at all.
>
>Can someone explain a bit more about bookmarks or refer me to a source? My
>thanks and regards for all the help the mvp's have provided over the years.
>
>Lenny

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA help window: Multiple windows/tabs, bookmarks, bookmarks/historypane paul.domaskis@gmail.com Microsoft Outlook VBA Programming 4 19th May 2009 02:09 PM
Word 2007 bookmarks - How to display bookmarks on page? =?Utf-8?B?cmdpbGxl?= Microsoft Word Document Management 1 21st Apr 2007 10:06 PM
MY BOOKMARKS GO INTO MY HUSBANDS BOOKMARKS ALSO PattiChati Windows XP Help 2 19th Apr 2007 07:10 PM
Bookmarks Barry Karas Windows XP Help 2 26th Jun 2006 08:13 PM
Bookmarks Percy Windows XP New Users 4 8th Feb 2006 04:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:26 AM.