PDA

View Full Version : Problem with accessing bookmarks



VickyC
12-17-2007, 04:01 AM
Good Morning,

I am creating a template to incorporate our office address in the header.

I have created a form to open and there is a list of offices to choose. From here which ever office is choosen I want the corresponding address to be in inserted into the header and the remaining address to be inserted into the footer.

I have added a bookmark called location in the header although I am unable to get to this???? http://www.access-programmers.co.uk/forums/images/smilies/confused.gif

this is the code I have so far...>?> I would really appreciate any advise you can give me....???

Thanks, http://www.access-programmers.co.uk/forums/images/smilies/smile.gif

' Office Location editing headed paper
If cbOffice.Text = "Milton Keynes" Then
ActiveDocument.Bookmarks("location").Range.Text = "Address, Milton Keynes"
ActiveDocument.Bookmarks("tel").Range.Text = "01908 000000"
ActiveDocument.Bookmarks("Fax").Range.Text = "01908 000001"
ActiveDocument.Bookmarks("DX").Range.Text = "000 MK 0"
End If

TonyJollans
12-17-2007, 04:12 AM
You should be able to access a bookmark simply enough.

What happens when you run it?

VickyC
12-17-2007, 04:18 AM
Hi Tony,

When I run it I do not get an error but address details are not being added. I then went to Insert > Bookmarks and when I select "location" I do not get an option to GoTo?

I am guessing that I need a command for it to go to the bookmark that is in the header??

It is really frustrating.....

TonyJollans
12-17-2007, 05:34 AM
'tis true! Insert > Bookmarks will not let you GoTo a bookmark in the Header if you are in the main document. The GoTo dialog will let you try but then fail to find it. But ...

ActiveDocument.Bookmarks("location").Range.Text = "whatever"

... should work alright. So ...

... are you sure the code is running (the IF is satisfied)?

VickyC
12-17-2007, 07:02 AM
I have got it working thanks for all your help.... Missed that bit....

:giggle

TonyJollans
12-17-2007, 08:41 AM
phew! :)