Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-14-2016, 07:16 PM
DougMVP DougMVP is offline How to add a hyperlink in VBA to a bookmark within a document Windows 7 32bit How to add a hyperlink in VBA to a bookmark within a document Office 2010 32bit
Advanced Beginner
 
Join Date: Nov 2013
Posts: 50
DougMVP will become famous soon enough
Default

Use:

Code:
Dim oRng As Range
Dim newfield As Field
Dim hlink As Hyperlink
Set oRng = Selection.Range
Set newfield = ActiveDocument.Fields.Add(oRng, wdFieldEmpty, "HYPERLINK \l " & Chr(34) & "Link2Create" & Chr(34))
Set hlink = Selection.Paragraphs(1).Range.Hyperlinks(1)
hlink.TextToDisplay = "txt2cpy"
Reply With Quote
 

Tags
hyperlink current

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct Bookmark Hyperlink Phil H Word 2 02-10-2016 12:55 PM
Replicating Insert Hyperlink-Bookmark function Marrick13 Word VBA 0 02-05-2016 01:27 PM
Hyperlink: open the document only once, quit & reopen PP, hyperlink doesnt work anymore quanghuynguyenhua PowerPoint 0 10-10-2015 06:17 PM
How to add a hyperlink in VBA to a bookmark within a document Clicking a Hyperlink to bookmark in other open doc moves that doc's position! diracsbracket Word 1 08-14-2014 04:07 PM
How to highlight bookmark after clicking hyperlink readysteadykitty Word 0 07-04-2013 10:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:57 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft