View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] korrin.anderson@gmail.com is offline
external usenet poster
 
Posts: 12
Default How do I add a hyperlink to a particular cell to a textbox using vba?

Good afternoon!

I have a macro which creates text boxes in excel, based on values in a
hidden worksheet. One of thos values is a location within the
workbook, ie "Sheet1!A2". When creating the textbox in vba, I would
like the text box (or the text within the box) to be linked to that
cell. I have looked everywhere and cannot find anything on how to do
this.

Here is the code which creates the textbox:

dim dealtextbox as shape

Set DealTextbox =
Sheets(1).Shapes.AddTextbox(Orientation:=msoTextOr ientationHorizontal,
_
Left:=350, Top:=lengthPrevBox + 10, Width:=600, Height:=10)

With DealTextbox
.TextFrame.AutoSize = True
If .Width 300 Then
y = .Width * .Height
.Width = 300
.Height = (y / 200)
End If
.TextFrame.Characters(1, 11).Font.Bold = True
end with