marco

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
..
 
J

Jake Marx

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")
 
D

David Kuehl

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.
 
J

Jake Marx

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.
 
J

Jake Marx

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top