![]() |
45 seconds to save a file, why so long?
Why would this code:
If sSaveFolder < "Rollup" Then ActiveWorkbook.SaveAs FileName:=sSaveLoc & "\" & sSaveFolder & "\" & sBranch & "_" & sPeriod & "_Ops_Rvw_Pckg" & ".xlsm" _ , FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False Else ActiveWorkbook.SaveAs FileName:=sSaveLoc & "\" & sBranch & "_" & sPeriod & "_Ops_Rvw_Pckg" & ".xlsm" _ , FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False End If take 45 secs to save a .5mb file when I can manually save the same file and it only takes a couple of seconds? Is there anything I can do to speed up this process? I'm already saving to my hard drive instead of to a network location. Thanks, Keith |
45 seconds to save a file, why so long?
I figured it out. It was because the new file had links back to the original
file, and that was requiring a lot of time to save (maybe it was calculating because of that too). But since I was going to break the links in the next line of code I just moved that line of code up above the SaveAs code, and problem solved. I did have to borrow some code from Ron de Bruin's web site (thanks a ton Ron, you rock!), because excel was bombing at first. Even though my line of code was working fine when used after the SaveAs, excel crashed when I tried to use it before saving the file. Go figure. But Ron's code did not have this problem. Just putting this out there for anyone who encounters a similar problem. Thanks, Keith "Keithlo" wrote: Why would this code: If sSaveFolder < "Rollup" Then ActiveWorkbook.SaveAs FileName:=sSaveLoc & "\" & sSaveFolder & "\" & sBranch & "_" & sPeriod & "_Ops_Rvw_Pckg" & ".xlsm" _ , FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False Else ActiveWorkbook.SaveAs FileName:=sSaveLoc & "\" & sBranch & "_" & sPeriod & "_Ops_Rvw_Pckg" & ".xlsm" _ , FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False End If take 45 secs to save a .5mb file when I can manually save the same file and it only takes a couple of seconds? Is there anything I can do to speed up this process? I'm already saving to my hard drive instead of to a network location. Thanks, Keith |
All times are GMT +1. The time now is 01:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com