bersoy
Computer
- Jun 14, 2002
- 1
I am a VBA programmer.
I have a challenge thatI have not been able to solve yet. I need to update an excel file with the newest version if current one is not the newest version. I have already handled everything necessary to check the versions etc.
Suppose that I have two files, with exactly the same VBA code in them. Only filenames are different: MyFile.xls and MyFileNEW.xls
When I double click on MyFile.xls, I need it to close AND DELETE ITSELF, then rename MyFileNEW.xls as MyFile.xls, then open newly renamed MyFile.xls
There is no event like "after workbook close".
I used FileSystemObject and tried this: On close event of MyFile.xls, code opens MyFileNEW.xls.
On activate or open of MyFileNEW.xls, it tries to close MyFile.xls then delete MyFile.xls on the next line. THE PROBLEM IS: MyFileNEW.xls closes MyFile.xls, it just stops executing further. It does not go to the next line where I want to delete MyFile.xls. I think this is because activation of MyFileNEW.xls was already trigered by MyFile.xls, that is why it just exits after it closes MyFile.xls and does not go to the next line in MyFileNEW.xls activation code.
PLEASE PLEASE PLEASE HELP!!!
I have a challenge thatI have not been able to solve yet. I need to update an excel file with the newest version if current one is not the newest version. I have already handled everything necessary to check the versions etc.
Suppose that I have two files, with exactly the same VBA code in them. Only filenames are different: MyFile.xls and MyFileNEW.xls
When I double click on MyFile.xls, I need it to close AND DELETE ITSELF, then rename MyFileNEW.xls as MyFile.xls, then open newly renamed MyFile.xls
There is no event like "after workbook close".
I used FileSystemObject and tried this: On close event of MyFile.xls, code opens MyFileNEW.xls.
On activate or open of MyFileNEW.xls, it tries to close MyFile.xls then delete MyFile.xls on the next line. THE PROBLEM IS: MyFileNEW.xls closes MyFile.xls, it just stops executing further. It does not go to the next line where I want to delete MyFile.xls. I think this is because activation of MyFileNEW.xls was already trigered by MyFile.xls, that is why it just exits after it closes MyFile.xls and does not go to the next line in MyFileNEW.xls activation code.
PLEASE PLEASE PLEASE HELP!!!