Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adapting recorded code

Status
Not open for further replies.

cdon

Programmer
Jul 5, 2003
17
GB
Hi

I have recorded the following macro

Sub aboutVLANS()
'
' aboutVLANS Macro
'
'

Selection.Range.Hyperlinks(1).Range.Fields(1).Result.Select
Selection.Range.Hyperlinks(1).Delete
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, address:="", _
SubAddress:="_About_VLANs"
Selection.Collapse Direction:=wdCollapseEnd
End Sub

which changes the current link from pointing to an external document to a heading in the current doc.

I have then changed the subaddress to

SubAddress:="_Displaying_VLANs"

in the hope that this would change any link this macro is run on to point to the Dislaying VLANs heading but it does not work.

Does anyone know how to change the above code to work with different headings within a Word 2000 document?

If I were to record myself manually changing the link to point to Displaying VLANs the macro would produce the same as I have above and work. Why when I edit the macro code does it not?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top