I have a macro called "Savecopy" that keeps failing due to screensavers and power save mode... I cant wrap my head around this... please help.
The point of the macro is that the "Private Sub Workbook_Open()" needs to be refreshed. (It fails whenever screensaver, power saving modes sets in. And because administrators refusing us to change this, we need to make some Macgyver solutions to it.)
Private Sub Workbook_Open() have an ontime code that calles a macro called savecopy that backs up the workbook every hour on a network drive. It works fine untill screensaver og power saving mode becomes active. Then it makes the workbook read only and the given filename impossible to overwrite. "Error message is that the same name can not be used"
So to force a refresh to the Private Sub Workbook_Open() thingie I thought id force a close workbook and reopen it, but i need to save the file first...
my first idea was then to save a backupfile. Close it and reopen it, and then run the "Savecopy" Macro... But:
Somehow my excel also requires me to have an open workbook to be able to switch between books. i can't close thisworkbook, and then reopen it unless there is another workbook open. then excel just closes everything and have an empty window (The program itself doesn't close)
My Idea is then:
1: Save the current workbook as: L:\Skiftledere\Pallelister\Backup.xlsm (making it the active workbook)
2: Inside backup.xlsm there is a macro called "Savecopy" wich is to be excecuted. (This will save backup.xlsm as a new file depending on certain cells. Lets just call it "Newfile" as an example)
4: newfile should open backup.xlsm and close newfile
5: backup.xlsm should open newfile again (then forcing a refresh to Private Sub Workbook_Open())
6: Backup.xlsm should be closed and killed/deleted
But this project is beyond me... my coding here seems to stop with closing books and new ones not continuing the cript...
Is there an easier way? (There are some codes that run when workbooks are opened, maybee this is why my coding fails?)
any help appreciated, as of now I can't sleep...
The point of the macro is that the "Private Sub Workbook_Open()" needs to be refreshed. (It fails whenever screensaver, power saving modes sets in. And because administrators refusing us to change this, we need to make some Macgyver solutions to it.)
Private Sub Workbook_Open() have an ontime code that calles a macro called savecopy that backs up the workbook every hour on a network drive. It works fine untill screensaver og power saving mode becomes active. Then it makes the workbook read only and the given filename impossible to overwrite. "Error message is that the same name can not be used"
So to force a refresh to the Private Sub Workbook_Open() thingie I thought id force a close workbook and reopen it, but i need to save the file first...
my first idea was then to save a backupfile. Close it and reopen it, and then run the "Savecopy" Macro... But:
Somehow my excel also requires me to have an open workbook to be able to switch between books. i can't close thisworkbook, and then reopen it unless there is another workbook open. then excel just closes everything and have an empty window (The program itself doesn't close)
My Idea is then:
1: Save the current workbook as: L:\Skiftledere\Pallelister\Backup.xlsm (making it the active workbook)
2: Inside backup.xlsm there is a macro called "Savecopy" wich is to be excecuted. (This will save backup.xlsm as a new file depending on certain cells. Lets just call it "Newfile" as an example)
4: newfile should open backup.xlsm and close newfile
5: backup.xlsm should open newfile again (then forcing a refresh to Private Sub Workbook_Open())
6: Backup.xlsm should be closed and killed/deleted
But this project is beyond me... my coding here seems to stop with closing books and new ones not continuing the cript...
Is there an easier way? (There are some codes that run when workbooks are opened, maybee this is why my coding fails?)
any help appreciated, as of now I can't sleep...