Cool, thanks Nigel!
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
:
| The below code works fine but you can do it much simpler. If you want to
open
| the Excel file by clicking a button called 'OpenExelFileBtn' then put this
| code in the OnClick event:
|
| Me.Controls("OpenExcelFileBtn").HyperlinkAddress =
"C:\data\excel\somewb.xls"
| ......All done in 1 line
|
| If you don't know the filename but are going to pick it up from a Text box
| on the form
|
| Me.Controls("OpenExcelFileBtn").HyperlinkAddress = " " ' Do this first
to
| make sure you don't carry something over from an invalid last try.
|
| If Dir(Me("TextBoxFilename") & ".XLS") = "" then
| MsgBox "File not found etc...."
| Exit Sub
| End IF
| Me.Controls("OpenExcelFileBtn").HyperlinkAddress = Me("TextBoxFilename") &
| ".XLS"
|
| Regards
| Nigel