Results 1 to 10 of 10
  1. #1
    Lounger
    Join Date
    Nov 2004
    Posts
    46
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I have a document that has bookmarks populated from an access dBase by a VB driven code - not originated by me
    I need to change the document to print a bookmark in two locations. I know using bookmarks this is not possible per se but believed that the 'REF' could be used to do this. For some reason I cannot fathom I am not being successful and hence my request for advice.
    Please can you suggest correct method to do this
    Thank you

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    If you have a bookmark named MyPlace in the document, you can refer to the contents of the bookmark elsewhere in the document as follows:

    - Click in the position where you want the reference.
    - Press Ctrl+F9 to insert field braces { } (don't type those yourself!)
    - Between the braces, type the name of the bookmark, in this example MyPlace
    - Press F9 to hide the field code and to update the field.

  3. #3
    Lounger
    Join Date
    Nov 2004
    Posts
    46
    Thanks
    3
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='765017' date='12-Mar-2009 14:38']If you have a bookmark named MyPlace in the document, you can refer to the contents of the bookmark elsewhere in the document as follows:

    - Click in the position where you want the reference.
    - Press Ctrl+F9 to insert field braces { } (don't type those yourself!)
    - Between the braces, type the name of the bookmark, in this example MyPlace
    - Press F9 to hide the field code and to update the field.[/quote]

    Hi Hans
    I've tried. - The bookmark name is - Signature
    I pressed Ctrl + F9 = { Signature } and when it merges the space is blank
    I also tried {REF Signature }

    I'd add the box is ticked to update field before printing
    Thanks

    Duncan

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The most plausible explanation is that there is no text in the Signature bookmark...

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    [quote name='Duncan McDonald' post='765053' date='12-Mar-2009 16:13']I pressed Ctrl + F9 = { Signature } and when it merges the space is blank[/quote]
    Are you quite sure that the bookmark actually contains some text. If you use Edit > GoTo to select the bookmark is the text you expect highlighted? Or is the bookmark simply a point in the document.

  6. #6
    Lounger
    Join Date
    Nov 2004
    Posts
    46
    Thanks
    3
    Thanked 0 Times in 0 Posts
    [quote name='StuartR' post='765058' date='12-Mar-2009 16:32']Are you quite sure that the bookmark actually contains some text. If you use Edit > GoTo to select the bookmark is the text you expect highlighted? Or is the bookmark simply a point in the document.[/quote]

    Hi Both

    The bookmark relates to data held in an Access database. I am presently trying to find out from the developer if there is any reason from their application why the content may be empty.
    Thanks

  7. #7
    New Lounger
    Join Date
    Apr 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='Duncan McDonald' post='765243' date='13-Mar-2009 14:39']Hi Both

    The bookmark relates to data held in an Access database. I am presently trying to find out from the developer if there is any reason from their application why the content may be empty.
    Thanks[/quote]

    The software seems not to be inserting text into the document but rather, as suggested, using the bookmark to points to populate the document with the data held in their Access dBase. You are therefore correct in saying the content is empty.
    I guess the next question is; Can the original bookmark information be captured ? Or is there any other suggestion you may have to help.

    Thank you
    Duncan

  8. #8
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    [quote name='Duncan_McDonald' post='767147' date='24-Mar-2009 23:36']Can the original bookmark information be captured ? Or is there any other suggestion you may have to help.[/quote]
    After the text has been inserted, I assume that the bookmark will mark either the beginning of the end of the text you want. Do you have any way to identify the other end of this text?

  9. #9
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='Duncan_McDonald' post='767147' date='25-Mar-2009 10:36']The software seems not to be inserting text into the document but rather, as suggested, using the bookmark to points to populate the document with the data held in their Access dBase. You are therefore correct in saying the content is empty.
    I guess the next question is; Can the original bookmark information be captured ? Or is there any other suggestion you may have to help.

    Thank you
    Duncan[/quote]
    Hi Duncan,

    It's unlikely your present Access code preserves the bookmark. Here's some Word vba code to update (and preserve) a bookmark, by passing the bookmark name and its new contents to the procedure. Your developer should be able to modify the Access code to work along similar lines. Then, a cross-reference to the bookmark should work (especially if '.Fields.Update' is added before 'End With').
    Code:
    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
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  10. #10
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    [quote name='macropod' post='767232' date='25-Mar-2009 11:45']
    Code:
     With ActiveDocument
    [/quote]
    If you are running this VBA code from within Access then you must fully qualify all references, so instead of ActiveDocument you should use wrdApp.ActiveDocument (replace wrdApp with the object you created that points to the word application)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •