Update Autoshape's Hyperlink

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

Hello All,

I have a series of autoshapes with hyperlinks and I'm trying create a macro
which will update the hyperlinks. Here are the requirements:

1) User enters a variable in a dialog box
2) The variable captured will be used in the link (variable = x)
2) Macro updates the autoshape "Autoshape3" replaces old link with the new
link "http://example.com/subscription.asp&refID=x"

I've been trying to search for the right code to update the autoshapes with
the new link, but haven't been able to find it.

Thanks for all your help.
 
Option Explicit

Sub test()
Dim aWS as Worksheet

Dim myShape As Shape
Set aWS = ActiveSheet

on error resume next
set myShape = aWS.shapes("Autoshape3")
on error goto 0

if not myShape is nothing then
myShape.Hyperlink.Address = +
"http://example.com/subscription.asp&refID=x"
End If
End Sub

HTH,
Barb Reinhardt
 
Hello Barb,

Thanks for the quick response.

The code you provided helps me update the link. I would also like to have
the user enter a number in a dialog box, have that number set as a variable
to change the X in the hyperlink.

Thanks for your help.
 
Back
Top