Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
marco
I have created several marco's in Excel and they work
great when you map to the drive they are on and run them normal. If you try to run them through Explorer it gives an error. Run-time error '1004': Method 'Open' of object "Workbooks" failed The line of code it points to in the macro is as follows: Workbooks.open Filename:="\\DKUEHL-ras1 \info_website\CurrentFile.xls DKUEHL-ras1 is the name of the server. I am at a lost what it is looking or asking for .. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
marco
Hi David,
Are you sure you have the correct UNC path to the file? What does this return when entered via the Immediate window? ?Dir$("\\DKUEHL-ras1\info_website\CurrentFile.xls") -- Regards, Jake Marx MS MVP - Excel David Kuehl wrote: I have created several marco's in Excel and they work great when you map to the drive they are on and run them normal. If you try to run them through Explorer it gives an error. Run-time error '1004': Method 'Open' of object "Workbooks" failed The line of code it points to in the macro is as follows: Workbooks.open Filename:="\\DKUEHL-ras1 \info_website\CurrentFile.xls DKUEHL-ras1 is the name of the server. I am at a lost what it is looking or asking for . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
marco
I am not a programmer by trade (I guess that is obvious).
What is a UNC path and what do you mean by Immediate window? I I replace the line in my macro with it I get a complier error "method not valid without suitable object". I do appreciate your help. -----Original Message----- Hi David, Are you sure you have the correct UNC path to the file? What does this return when entered via the Immediate window? ?Dir$("\\DKUEHL-ras1\info_website\CurrentFile.xls") -- Regards, Jake Marx MS MVP - Excel David Kuehl wrote: I have created several marco's in Excel and they work great when you map to the drive they are on and run them normal. If you try to run them through Explorer it gives an error. Run-time error '1004': Method 'Open' of object "Workbooks" failed The line of code it points to in the macro is as follows: Workbooks.open Filename:="\\DKUEHL-ras1 \info_website\CurrentFile.xls DKUEHL-ras1 is the name of the server. I am at a lost what it is looking or asking for . . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
marco
Hi David,
The Immediate window is available in the VBE (Visual Basic Editor). Just hit Ctrl+G and it should appear below the code pane. Typing ? before a statement that returns a value will cause it to output the value in the window. It's a sort of command window. A UNC is a Universal Naming Convention, which allows you to map the path to a file without mapping a drive. As you've done, it is constructed as \\servername\sharedfolder\subfolder\filename. Anyway, if you do a ?Dir$("<yourUNCpath") in the Immediate window, you will see if the path is correct and/or accessible. -- Regards, Jake Marx MS MVP - Excel David Kuehl wrote: I am not a programmer by trade (I guess that is obvious). What is a UNC path and what do you mean by Immediate window? I I replace the line in my macro with it I get a complier error "method not valid without suitable object". I do appreciate your help. -----Original Message----- Hi David, Are you sure you have the correct UNC path to the file? What does this return when entered via the Immediate window? ?Dir$("\\DKUEHL-ras1\info_website\CurrentFile.xls") -- Regards, Jake Marx MS MVP - Excel David Kuehl wrote: I have created several marco's in Excel and they work great when you map to the drive they are on and run them normal. If you try to run them through Explorer it gives an error. Run-time error '1004': Method 'Open' of object "Workbooks" failed The line of code it points to in the macro is as follows: Workbooks.open Filename:="\\DKUEHL-ras1 \info_website\CurrentFile.xls DKUEHL-ras1 is the name of the server. I am at a lost what it is looking or asking for . . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
marco
Hi David,
That means that the file does indeed exist in that UNC location. So that rules out a bad path. One thing to try (should have thought of this earlier) - make sure "Ignore other applications" is *unchecked* in Tools | Options / General tab in Excel. If it's checked, it can cause problems when files are launched from Explorer. -- Regards, Jake Marx MS MVP - Excel David Kuehl wrote: If I enter that in and then hit enter it returns CurrentFile.xls. Now I am really confused. -----Original Message----- Hi David, The Immediate window is available in the VBE (Visual Basic Editor). Just hit Ctrl+G and it should appear below the code pane. Typing ? before a statement that returns a value will cause it to output the value in the window. It's a sort of command window. A UNC is a Universal Naming Convention, which allows you to map the path to a file without mapping a drive. As you've done, it is constructed as \\servername\sharedfolder\subfolder\filename. Anyway, if you do a ?Dir$("<yourUNCpath") in the Immediate window, you will see if the path is correct and/or accessible. -- Regards, Jake Marx MS MVP - Excel David Kuehl wrote: I am not a programmer by trade (I guess that is obvious). What is a UNC path and what do you mean by Immediate window? I I replace the line in my macro with it I get a complier error "method not valid without suitable object". I do appreciate your help. -----Original Message----- Hi David, Are you sure you have the correct UNC path to the file? What does this return when entered via the Immediate window? ?Dir$("\\DKUEHL-ras1\info_website\CurrentFile.xls") -- Regards, Jake Marx MS MVP - Excel David Kuehl wrote: I have created several marco's in Excel and they work great when you map to the drive they are on and run them normal. If you try to run them through Explorer it gives an error. Run-time error '1004': Method 'Open' of object "Workbooks" failed The line of code it points to in the macro is as follows: Workbooks.open Filename:="\\DKUEHL-ras1 \info_website\CurrentFile.xls DKUEHL-ras1 is the name of the server. I am at a lost what it is looking or asking for . . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Marco | Excel Discussion (Misc queries) | |||
Marco Help | Excel Discussion (Misc queries) | |||
marco to format top 80% | Excel Discussion (Misc queries) | |||
I need some help with a Marco | Excel Discussion (Misc queries) | |||
Marco | New Users to Excel |