Hi you all,
I have a userform, with this code.
Is it possible to make a code, so every time Label1 is inserted in the worksheet, it will work as a hyperlink?
Now is it just a "dead" cell.
I have a userform, with this code.
Is it possible to make a code, so every time Label1 is inserted in the worksheet, it will work as a hyperlink?
Now is it just a "dead" cell.
Code:
Private Function MakeCursorFromBytes() As String
#If VBA7 Then
Const ByteFactor = 24
#Else
Const ByteFactor = 16
#End If
Dim lPos As Long
Dim arCurBytes1() As Variant
Dim arCurBytes2() As Variant
arCurBytes1 = Array(0, 0, 2, 0, 1, 0, 32, 32, 16, 0, 12, 0, 1, 0, 232, 2, _
0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 32, 0, 0, 0, 64, 0, _
0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 128, 2, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 128, 0, 0, 128, 0, 0, 0, 128, 128, 0, 128, 0, _
0, 0, 128, 0, 128, 0, 128, 128, 0, 0, 128, 128, 128, 0, 192, 192, _
192, 0, 0, 0, 255, 0, 0, 255, 0, 0, 0, 255, 255, 0, 255, 0, _
0, 0, 255, 0, 255, 0, 255, 255, 0, 0, 255, 255, 255, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 15, 255, 255, 248, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 255, 255, 255, 255, 128, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 15, 255, 255, 255, 255, 128, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 255, 255, 255, 255, 255, 248, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 255, 255, 255, 255, 255, 248, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 15, 255, 255, 255, 255, 255, 248, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 15, 255, 255, 255, 255, 255, 255, 128, 0, 0, 0, 0, 0, 0)
arCurBytes2 = Array(0, 0, 255, 255, 255, 255, 255, 255, 255, 128, 0, 0, 0, 0, 0, 0, _
0, 0, 255, 136, 255, 255, 255, 255, 255, 128, 0, 0, 0, 0, 0, 0, _
0, 15, 248, 0, 255, 255, 255, 255, 255, 128, 0, 0, 0, 0, 0, 0, _
0, 15, 128, 0, 255, 255, 255, 255, 127, 128, 0, 0, 0, 0, 0, 0, _
0, 248, 0, 0, 255, 127, 247, 248, 15, 128, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 15, 128, 248, 15, 128, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 15, 128, 248, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 15, 128, 248, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 15, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, _
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, _
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 248, _
7, 255, 255, 240, 7, 255, 255, 224, 3, 255, 255, 192, 3, 255, 255, 128, _
1, 255, 255, 128, 1, 255, 255, 0, 1, 255, 255, 0, 0, 255, 254, 0, _
0, 255, 254, 0, 0, 255, 252, 0, 0, 255, 252, 32, 0, 255, 248, 96, _
0, 255, 252, 224, 0, 255, 255, 224, 1, 255, 255, 224, 7, 255, 255, 224, _
15, 255, 255, 224, 127, 255, 255, 225, 255, 255, 255, 225, 255, 255, 255, 225, _
255, 255, 255, 225, 255, 255, 255, 243, 255, 255, 255, 255, 255, 255, 255, 255)
MakeCursorFromBytes = SaveCurToDisk(ByVal arCurBytes1)
End Function
Private Function SaveCurToDisk(ByVal Ar As Variant) As String
Dim i As Long
Dim FileNum As Long
Dim Bytes() As Byte
ReDim Bytes(LBound(Ar) To UBound(Ar))
For i = LBound(Ar) To UBound(Ar)
Bytes(i) = CByte((Ar(i)))
Next
FileNum = FreeFile
Open Environ("Temp") & "\temp.cur" For Binary As #FileNum
Put #FileNum, 1, Bytes
Close FileNum
SaveCurToDisk = Environ("Temp") & "\temp.cur"
End Function
Private Sub Label1_Click()
If Len(Label1.Caption) <> 0 Then
Shell "explorer.exe" & " " & Label1.Caption, vbNormalFocus
End If
End Sub
Private Sub boAdd_Click()
Dim erow As Long
arow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(arow, 1).Value = CbName.Value
Cells(arow, 2).Value = Val(TextBoxAge.Text)
Cells(arow, 3).Value = TextBoxGender.Text
Cells(arow, 4).Value = cbInterest.Value
Cells(arow, 5).Value = Label1.Caption
Brow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(Brow, 4).Value = cbInterest2.Value
If cbInterest2.Value <> "" Then
Cells(Brow + 0, 1).Value = CbName.Value
Cells(Brow + 0, 2).Value = Val(TextBoxAge.Text)
Cells(Brow + 0, 3).Value = TextBoxGender.Text
Cells(Brow + 0, 5).Value = Label1.Caption
End If
Crow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(Crow, 4).Value = cbInterest3.Value
If cbInterest3.Value <> "" Then
Cells(Crow + 0, 1).Value = CbName.Value
Cells(Crow + 0, 2).Value = Val(TextBoxAge.Text)
Cells(Crow + 0, 3).Value = TextBoxGender.Text
Cells(Crow + 0, 5).Value = Label1.Caption
End If
End Sub
Private Sub boSource_Click()
Dim sPath As String
On Error Resume Next
With Label1
.BackStyle = fmBackStyleTransparent
.Font.Name = "Courier New"
.Font.Underline = True
.Font.Bold = True
.Font.Size = 10
.WordWrap = False
.ForeColor = vbBlue
.ControlTipText = "Click Link to open folder."
sPath = CreateObject("Shell.Application").BrowseForFolder(0, "Select a Folder...", 0, 0).Self.Path
If Len(sPath) Then Label1.Caption = sPath
End With
End Sub
Private Sub UserForm_Initialize()
Label1.Caption = ""
Label1.BackStyle = fmBackStyleTransparent
End Sub