Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-19-2015, 12:55 PM
Bengt Bengt is offline Moving from hyperlink to hyperlink in a document Windows 7 32bit Moving from hyperlink to hyperlink in a document Office 2003
Novice
Moving from hyperlink to hyperlink in a document
 
Join Date: Feb 2013
Posts: 8
Bengt is on a distinguished road
Default Moving from hyperlink to hyperlink in a document

Hi everyone,


I have been given the following task and I am not sure how to do it. Can anyone help?

I need to do the following:
I have a Word-document with a big number of hyperlinks in it, about 400. When the links were created, they were created in an erroneous way, so what I would like to do is to go from hyperlink to hyperlink and edit the incorrect URL and through some string manipulation create a correct URL and then put it back in again. The error it seems, is made in a systematic way, so there is really only a problem identifying various parts of the string. That is not a problem. The problem is how to do this through VBA-code. Can it be done? Is there a collection of hyperlinks through which I can traverse?

Grateful for any help


Bengt
Reply With Quote
  #2  
Old 12-20-2015, 03:33 PM
gmaxey gmaxey is offline Moving from hyperlink to hyperlink in a document Windows 7 32bit Moving from hyperlink to hyperlink in a document Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,427
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Something like this:

Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oHL As Hyperlink
For Each oHL In ActiveDocument.Hyperlinks
oHL.Address = Replace(oHL.Address, "http", "https")
Next oHL
lbl_Exit:
Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 12-21-2015, 12:42 AM
Bengt Bengt is offline Moving from hyperlink to hyperlink in a document Windows 7 32bit Moving from hyperlink to hyperlink in a document Office 2003
Novice
Moving from hyperlink to hyperlink in a document
 
Join Date: Feb 2013
Posts: 8
Bengt is on a distinguished road
Default

Dear Greg,
Thanks a lot. It looks like something that I could use. Good that you pointed out that there is a Collection of hyperlinks. I didn't know that.

I'll work with your code suggestion and try to expand it.

Bengt
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink: open the document only once, quit & reopen PP, hyperlink doesnt work anymore quanghuynguyenhua PowerPoint 0 10-10-2015 06:17 PM
Hyperlink Format varies, depending on whether Target file was saved or unsaved on Hyperlink Copy RichardDavey Word 0 05-26-2015 05:26 PM
Moving from hyperlink to hyperlink in a document Insert the Hyperlink and hide all sheets except clicking Hyperlink PRADEEPB270 Excel 1 02-22-2013 09:47 AM
Moving from hyperlink to hyperlink in a document Hyperlink to Partial Document Name shira47 Word 1 03-22-2012 03:40 PM
Moving from hyperlink to hyperlink in a document Inserting a document (from a website hyperlink) MrWord Word VBA 2 02-07-2012 05:56 PM

Other Forums: Access Forums

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


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