45 seconds to save a file, why so long?

K

Keithlo

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
 
K

Keithlo

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
 

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

Top