Hi,
I have a number of text boxes in a sheet that i'm assigning text and hyperlink. the code under here works except for this line: shMonth.Hyperlinks.Delete.
What am I doing wrong here?
Thanks,
Frank
I have a number of text boxes in a sheet that i'm assigning text and hyperlink. the code under here works except for this line: shMonth.Hyperlinks.Delete.
What am I doing wrong here?
Thanks,
Frank
VBA Code:
Sub test()
Dim wS As Worksheet
Set wS = Worksheets("January")
Dim shMonth As Shape
Dim nMonth(1 To 2, 1 To 12) As String
Dim mNuber As Integer
For i = 1 To 12
Set shMonth = wS.Shapes("TekstM" & CStr(i))
shMonth.Hyperlinks.Delete
If mNumber <> i Then wS.Hyperlinks.Add anchor:=shMonth, Address:="#'" & nMonth(1, i) & "'!A1"
With shMonth.TextFrame.Characters
If mNumber <> i Then
.Text = nMonth(2, i)
.Font.Bold = True
.Font.ColorIndex = 1
Else
.Text = nMonth(2, i)
.Font.Bold = False
.Font.ColorIndex = 15
End If
End With
Next
End Sub