Help with microsoft publisher9/8/2023 ![]() If oHyperlink.TextToDisplay Like "page *" Then If oHyperlink.TargetType = pbHlinkTargetTypePageID Then If oShape.HasTextFrame = False Then Exit Function MsgBox "Tagged as " & tagName & " = '" & txt & "'"įor Each oPage In ActiveDocument.MasterPagesįor Each oShape In MsgBox oHyperlink.pageId & " copied to clipboard as text" You can download my example project containing example content, instructions, and the macros below here: (it will probably give you a security warning because it contains macros)įull source Public Const tagName = "BookmarkPageId" Select the bookmark and run B_TagBookmarkWithPageId Select the hyperlink and run A_GetPageIdOfHyperlink Instructions for links to bookmarks (tagging workaround) Run C_RefreshReferenceLinks to refresh to check that it worked (otherwise RefreshReferenceLinks must be edited) Instead I've created a workaround in which you manually link the hyperlink and the bookmark with a tag object (creating a tag for the bookmark with the value of the non-existent page ID of the hyperlink).Ĭreate a hyperlink to a page. I spent quite a while trying to figure out what the relationship might be between this non-existent hyperlink and the bookmark, but to no avail. ![]() However, this doesn't work for links to bookmarks, which in the object model seem to behave like links to pages, except the pageID they refer to does not exist. The refresh macro simply recognizes those links and changes their display text to page X. My solution consists of two parts.įirst of all, links that should be refreshed are recognised by their display text starting with "page " (LIKE "page *"). It is fairly easy to write a macro to refresh links to pages, but links to bookmarks seem to be poorly supported by the object model, unless I've overlooked something. Let me know if this helps or if you for some reason need to do it in VBA The only time I have had problems is if the page is not long enough below the bookmark.and there are workarounds. Then select the text >insert hyperlink > place in this document and choose the bookmark that you just created. ![]() ![]() Just Insert > bookmark and drag that icon to where you want the link to go. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |