marco

  • Thread starter Thread starter David Kuehl
  • Start date Start date
D

David Kuehl

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
..
 
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")
 
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.
 
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.
 
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.
 
Back
Top