Run time error 53, cannot find file

G

GaryF

I'm using Office 2003.

A macro is set up to open a file "bingoinv.xls" and then save it as
"filename 2.xls". The next time the "bingoinv.xls" file shows up is in a
Later separate routine which is designed to Kill the "bingoinv.xls" and save
"filename2.xls" as "bingoinv.xls". The programing is shown below.

My problem is I get a runtime error 53 when it tries to Kill the
"bingoinv.xls" file when running the program on a networked computer. Other
pertinent facts are:
1. The program runs without problem on a different computer that is not on
a network.
2. I can go directly to the "bingoinv.xls"file which is where it is
expected to be, load it and then unload without saving and then renun the
macro without problems.
3. The program has worked flawlessly many times previously and to my
knowledg the only thing that may have changed is the computer itself which
was having problems and ultimately changed out.
4. I have considered inserting a command to load and unload the
"bingoinv.xls" file right before the Kill but think there might be a better
solution.

Is it possible that the problem is not the programming but some setup issue
on the networked computer. The program works fine for everything but the
kill feature.


'Opens "Cards & Daubers Inventory Report" named "bingoinv.xls" and sets
'up new sheet as "Filename 2".
'
Workbooks.Open Filename:=LocalPath + "\bingoinv.xls"
Windows("bingoinv.xls").Activate
ActiveWindow.WindowState = xlMinimized
Windows("bingoinv.xls").Activate
Application.Goto Reference:="report_date"
ActiveCell.Value = Format(SelectedDate, "MMM-DD-YYYY")
ActiveWorkbook.SaveAs Filename:=LocalPath & "\" & FileName2, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False


Sub SaveInventoryAndExit()

LocalPath =
Windows("FridayNightBINGO.xls").ActiveSheet.Range("LocalPath").Value
FileName1 =
Windows("FridayNightBINGO.xls").ActiveSheet.Range("FileName1").Value
FileName2 =
Windows("FridayNightBINGO.xls").ActiveSheet.Range("FileName2").Value
ChDir LocalPath

'ERASE existing m:\data\bingo\bingoinv.xls file
Kill "bingoinv.xls"

Windows(FileName2).Activate
ActiveWindow.WindowState = xlMaximized
ActiveSheet.Unprotect

'Save the active inventory file
ActiveWorkbook.Save

'Then save the inventory file as bingoinv.xls
' FileName2 is no longer open and can not be referenced

ActiveWorkbook.SaveAs Filename:=LocalPath & "\bingoinv.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
 
J

JLGWhiz

The only thing that I can see is that your path may not be what you think it
is when the files are saved or called while on the network. You could
manually walk through the code and check the values of those paths to be sure.
 
G

GaryF

I think is got it resolved by changing the default file location (Tools,
Option, General, Default file Location) from the C drive to the M drive where
the files are maintained. Even though the macro has a change directory
command to Local Drive, i,.e., "M" and it initially properly picked up the
file for some reason it apparently got lost when I did the "Save As".
Anyway, thanks for the suggestion which got me thinking.
 

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

Similar Threads


Top