PDA

View Full Version : How to create bookmark using vba within a word and then covert it to pdf



laboymc
06-04-2014, 11:22 AM
Hi,

Any help is appreciated.

How to create bookmark using vba within a word and then covert it to pdf and not loose the vba code?

So far this is what I have:
Sub Bookmark()
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="../Desktop/ES Attendance Training Doc.docx", SubAddress:="_Toc389644540"
End Sub

When doing this in word it works but when I convert it to pdf it will not go the SubAddress.

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="../Desktop/ES Attendance Training Doc.pdf", SubAddress:="_Toc389644540"

ranman256
06-04-2014, 12:19 PM
This is a hyperlink (external) not a bookmark (internal).
The address has "../Desktop"
if that is the literal setting , it wont work. It must be the entire drive path.

laboymc
06-06-2014, 04:48 AM
I added the entire drive path and when I convert if to pdf it won't open to the SubAddress created in the word doc. It works if the document in docx but not in pdf.