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

  • Thread starter Thread starter sue.birley
  • Start date Start date
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.
 
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
 
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
 
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.
 
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
 
Back
Top