Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-24-2015, 01:09 PM
gmaxey gmaxey is offline VBA Search Table for Text/Select Text/Insert Hyperlink Windows 7 32bit VBA Search Table for Text/Select Text/Insert Hyperlink Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub ForNovive()
  AddHyperlink ActiveDocument, "App A.", "C:\\My Documents\File\Appendix A.docx"
End Sub
Sub AddHyperlink(oDoc As Document, _
                 strText As String, _
                 strLink As String)
Dim oTbl As Table
Dim oHL As Hyperlink
Dim oRng As Range, oHLRange
  For Each oTbl In oDoc.Tables
    Set oRng = oTbl.Range
    With oRng.Find
      .Wrap = wdFindStop
      Do While .Execute(FindText:=strText)
        Set oHL = oDoc.Hyperlinks.Add(Anchor:=oRng.Duplicate, _
                  Address:=strLink, SubAddress:="", _
                  ScreenTip:="", TextToDisplay:=oRng.Duplicate.Text, _
                  Target:="")
        oRng.Start = oHL.Range.End
      Loop
    End With
  Next oTbl
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Word macro to find text, select all text between brackets, and delete helal1990 Word VBA 4 02-05-2015 03:52 PM
VBA Search Table for Text/Select Text/Insert Hyperlink VBA code for Microsoft Word macro — select text and insert footnote ndnd Word VBA 10 01-06-2015 01:47 PM
VBA Search Table for Text/Select Text/Insert Hyperlink Macro to search warning text style and replace the text color rohanrohith Word VBA 3 11-27-2014 01:08 PM
VBA Search Table for Text/Select Text/Insert Hyperlink Select section of text and change text newbieX Word VBA 3 03-28-2014 04:21 PM
VBA Search Table for Text/Select Text/Insert Hyperlink Select Text in Table but Table Gets Selected Too RBusiness Word 1 06-07-2011 04:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:31 PM.


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