Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 a 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. "GaryF" wrote: 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 a 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Maybe Kill LocalPath & "bingoinv.xls" Regards, Per On 22 Nov., 18:24, GaryF wrote: 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 a 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Take a look here 'Code Cage Downloads - The Code Cage Forums' (http://www.thecodecage.com/forumz/lo...tid=2&linkid=3) -- Simon Lloyd Regards, Simon Lloyd 'www.thecodecage.com' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=32898 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. "JLGWhiz" wrote: 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. "GaryF" wrote: 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 a 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error; | Excel Programming | |||
Appending to a file with run-time error '54' Bad file mode | Excel Programming | |||
Error 91 on Find second time through a loop | Excel Programming | |||
Run-time error 75 Path/File access error | Excel Programming | |||
Run-time error '91' on Cells.Find() | Excel Programming |