ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Time error 1004 (https://www.excelbanter.com/excel-programming/357083-run-time-error-1004-a.html)

Jim May

Run Time error 1004
 
In Cell B4 I have the string Array_Test.xls
When I double-Click on it (B4)


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Workbooks.Open Filename:="C:\Documents and Settings\Jim May\&
Target.value"
End Sub

I obviously want the file Array_Test.xls to open;
but "no go", Can someone assist?

TIA,



Mark Lincoln

Run Time error 1004
 
Not tested, but try:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Cancel = True
Workbooks.Open Filename:="C:\Documents and Settings\Jim May\" &
Target.value
End Sub

The difference is that the end double quote is moved from after
".value" to after "May\". Your code makes "&Target.value" look like
part of the path.


Jim May

Run Time error 1004
 
Thank you, thank you;
It works perfectly.
Jim

"Mark Lincoln" wrote in message
ups.com...
Not tested, but try:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Cancel = True
Workbooks.Open Filename:="C:\Documents and Settings\Jim May\" &
Target.value
End Sub

The difference is that the end double quote is moved from after
".value" to after "May\". Your code makes "&Target.value" look like
part of the path.





All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com