M
Murray
Hello
I have a macro that allows the user to insert a hyperlink to a pdf
file. The macro allows them to browse to a pdf file, click on it and
the link will be inserted. This seemed to be working fine until Excel
2003.
The pdf files are numbered, and may have leading zeroes (names are all
seven characters long).
Following are some fragments of my macro:
Sub CreateHyperlink()
Dim FName As String, DispName As String
'
Code to extract filename from full path and remove .pdf
'
'
' Create the hyperlink
'
ActiveSheet.Hyperlinks.Add Anchor:=ActiveCell, _
Address:=FName, TextToDisplay:=DispName
End Sub
If I "watch" the DispName variable, the code works correctly and it has
a seven digit value (such as 0654321). However, when inserted in the
spreadsheet the hyperlink drops the leading zero and displays 654321.
I've tried various formatting options. If I (via the macro) put an
apostrophe in front of DispName it shows up correctly (eg
TextToDisplay:="'" & DispName), but then the XL2003 error checking
kicks in and I get little green triangles everywhere.
Can anyone suggest what might have changed between 2000 and 2003, and
more importantly how I can prevent it from dropping the leading zeroes?
Thanks
Murray
I have a macro that allows the user to insert a hyperlink to a pdf
file. The macro allows them to browse to a pdf file, click on it and
the link will be inserted. This seemed to be working fine until Excel
2003.
The pdf files are numbered, and may have leading zeroes (names are all
seven characters long).
Following are some fragments of my macro:
Sub CreateHyperlink()
Dim FName As String, DispName As String
'
Code to extract filename from full path and remove .pdf
'
'
' Create the hyperlink
'
ActiveSheet.Hyperlinks.Add Anchor:=ActiveCell, _
Address:=FName, TextToDisplay:=DispName
End Sub
If I "watch" the DispName variable, the code works correctly and it has
a seven digit value (such as 0654321). However, when inserted in the
spreadsheet the hyperlink drops the leading zero and displays 654321.
I've tried various formatting options. If I (via the macro) put an
apostrophe in front of DispName it shows up correctly (eg
TextToDisplay:="'" & DispName), but then the XL2003 error checking
kicks in and I get little green triangles everywhere.
Can anyone suggest what might have changed between 2000 and 2003, and
more importantly how I can prevent it from dropping the leading zeroes?
Thanks
Murray