Thread: Save "speed up"
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default Save "speed up"

Since you are saving the same workbook twice, why not consider copying the
first saved workbook as a temp version, then change its name ?

Also if you do nothing to the workbook when it first opens, you could apply
the above logic to both the first and second copy, in this case a save is
not even involved.

(If your network restrictions do not allow it - please ignore this proposal)

--
Cheers
Nigel



"Mike" wrote in message
...
Hi!

I have a workbook that includes a macro (size is 750 kb). When the user
opens the workbook a number is generated (+ 1). The workbook is saved to a
temp location with the new number and the original workbook is saved and
closed (also with the new number).

My question is: is it possible to speed up this (now it takes 20-30 sec).

The code:

'This code saves the original workbook with the new number:

If Me.Saved = False Then Me.Save

'This code saves the temp workbook:

FileSaveName = ActiveWorkbook.Path
FileSaveNameEnd = FileSaveName & "\Arkiv\"
varName = ActiveSheet.Name
varDir = FileSaveNameEnd
varYear = Format(Date, "yyyy")
varNr = ReportNumber
ActiveSheet.SaveAs Filename:=varDir & varName & varNr & varYear

Can i do something else to speed up the saving process?

Mike