Update Autoshape's Hyperlink

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.
 
B

Barb Reinhardt

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
 
M

Max

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top