We help IT Professionals succeed at work.
Get Started

Change hyperlink addresses that contain a certain substring using VBA

127 Views
Last Modified: 2017-03-11
Dear Experts:

I got hundreds of hyperlinks on the active worksheet. All of the hyperlink addresses point to network paths.
Lots of them now have to be changed the following way:

Examples and Requirements:

Before

C:\test\MyProduct_90-234-56-17_new_bw.pdf  
C:\test\MyProduct_90-433-22-19_old_bw.pdf
C:\test\MyProduct_90-373-44-18_old_updated_bw.pdf
C:\test\MyProduct_90-244-19-22_bw.pdf
C:\test\MyProduct_90-243-44-11_old_bw.pdf
C:\test\MyProduct_90-433-22-99_bw.pdf
etc.

Only hyperlinks which contain the following substrings are to be worked on: 90-433-22-19, 90-244-19-22, 90-433-22-99
In the above three cases the substring 'bw' at the very end has to be changed to '4c'

In the above example this results in:

After:

C:\test\MyProduct_90-234-56-17_new_bw.pdf  
C:\test\MyProduct_90-433-22-19_old_4c.pdf
C:\test\MyProduct_90-373-44-18_old_updated_bw.pdf
C:\test\MyProduct_90-244-19-22_4c.pdf
C:\test\MyProduct_90-243-44-11_old_bw.pdf
C:\test\MyProduct_90-433-22-99_4c.pdf

All the others have to be left untouched since they do not contain these substrings.

Would be great if somebody could come up with a VBA-solution since I have to change hundreds of these hyperlink addresses. This would save me hours of time.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
Comment
Watch Question
Retired
CERTIFIED EXPERT
Top Expert 2012
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE