Workbooks.Open Filename:=.UpdateLinks:=0, IgnoreReadOnlyRecommended:=True

S

sue.birley

I can't seem to get this to work. I have read some of the other posts
for a similar bit of code but still can't get it to work. Can any one
help?

The error message says it is a

Run-time error '1004':
"could not be found. Check the spelling of the filename, and verify
that the file location is correct. etc, etc

The debug then highlights the bit of code I have put in my subject
heading.

What puzzels me about the message is that I am producing a list of
files from a source folder, so the spelling is as written on the file
names and not something I have typed into my list manually.
 
D

Dave O

Hi, Sue-
The line of code you posted in your subject line does not contain a
filename: I got that line to work when I used a filename, comme ca:
Workbooks.Open Filename:="c:\ok2del.xls", UpdateLinks:=0,
IgnoreReadOnlyRecommended:=True

Did you inadvertently leave that out of your code?

DaveO
Eschew obfuscation
 
D

Dave O

Hi, Sue-
The line of code you posted in your subject line does not contain a
filename: I got that line to work when I used a filename, comme ca:
Workbooks.Open Filename:="c:\ok2del.xls", UpdateLinks:=0,
IgnoreReadOnlyRecommended:=True

Did you inadvertently leave that out of your code?

DaveO
Eschew obfuscation
 
S

sue.birley

Hi, Sue-
The line of code you posted in your subject line does not contain a
filename: I got that line to work when I used a filename, comme ca:
Workbooks.Open Filename:="c:\ok2del.xls", UpdateLinks:=0,
IgnoreReadOnlyRecommended:=True

Did you inadvertently leave that out of your code?

DaveO
Eschew obfuscation

Yes I did miss it off. Tthe fielname is Filename but I haven't
defined it. Thanks for the clue. I'll try again.
 
S

sue.birley

Yes I did miss it off. Tthe fielname is Filename but I haven't
defined it. Thanks for the clue. I'll try again.

Hi everyone thanks for your tips
It all works fine now. This is my complete code

For X = 0 To RAfiles - 1
Y = Workbooks(Budsbk).Worksheets("RA Importer").Cells(16 + X, 5).Value
Workbooks.Open Y, UpdateLinks:=0, IgnoreReadOnlyRecommended:=True
 

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