jonreyno
04-10-2012, 03:43 AM
Hi All,
I have the following code which works apart from 3 aspects:
When you click 'Cancel' to close the 'Select File' window, the cell where the hyperlink is set is populated with 'FALSE' - Can this be altered so when you cancel the window it doesn't put anything in the cell?
When you click 'Cancel' to close the window, the Checkbox still leaves the tick in the box - Can this be altered that when you click 'Cancel' the box is left unticked?
The hyperlink address shows the full path to the file and I would like only the file name. THe code is:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Dim vFile As Variant, Sh As Object, rownum As Long, colnum As Long
rownum = 43 'for example
colnum = 11 'for example
vFile = Application.GetOpenFilename("All Files,*.*", Title:="Find file to insert", MultiSelect:=False)
If vFile = "false" Then
End Sub
Cells(rownum, colnum).Formula = "=HYPERLINK(""" & vFile & """)"
End Sub
Any advice would be great.
Thanks
Jon
I have the following code which works apart from 3 aspects:
When you click 'Cancel' to close the 'Select File' window, the cell where the hyperlink is set is populated with 'FALSE' - Can this be altered so when you cancel the window it doesn't put anything in the cell?
When you click 'Cancel' to close the window, the Checkbox still leaves the tick in the box - Can this be altered that when you click 'Cancel' the box is left unticked?
The hyperlink address shows the full path to the file and I would like only the file name. THe code is:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Dim vFile As Variant, Sh As Object, rownum As Long, colnum As Long
rownum = 43 'for example
colnum = 11 'for example
vFile = Application.GetOpenFilename("All Files,*.*", Title:="Find file to insert", MultiSelect:=False)
If vFile = "false" Then
End Sub
Cells(rownum, colnum).Formula = "=HYPERLINK(""" & vFile & """)"
End Sub
Any advice would be great.
Thanks
Jon