View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Too long to save an Excel file

Whilst there are no hard rules, in general with large overall projects it's
a good idea to split processing (code), logic (formulas), data, input and
output (not necessarily a separate file for each). If you have serious work
to do there are excellent examples in the book "Professional Excel
Development" by Bullen, Bovey & Green. I think I saw it has been updated for
2007.

The code could indeed be in an Addin. You could install in the Addin manager
which will cause it to load at startup, or you might only want it to load
if/when your data workbook opens. Maybe you have several data workbooks,
something like the following could go in each one -

Sub OpenEventStuff() ' Workbook_Open or Auto_Open
Dim sPath As String
Dim wb As Workbook
Const cCodeFile As String = "vvvTmp.xls"

sPath = "C:\Documents and Settings\Owner\My Documents\"

On Error Resume Next

Set wb = Workbooks("myAddin.xla")
On Error GoTo errH

If wb Is Nothing Then
Set wb = Workbooks.Open(sPath & cCodeFile)
End If


Exit Sub
errH:
' errer handler code

End Sub

I have no idea what your code does but you might want a small amount of code
in the data workbook to liase with the addin. You might ant to set a
reference in the data workbook to the addin, if you do best to rename the
default VBAProject in the addin.

Not knowing what you have, but say you have a small amount of worksheet
cells which are for manual data entry, instead of an addin you might combine
the code and the entry into a normal workbook, then have the code validate
the data and save it to a data file. I could go on with many more ideas but
it all depends on what you are doing.

Regards,
Peter T




"sk005" wrote in message
...
Thanks very much for your suggestions.

Hi Peter T: Could you please elaborate a bit more on your suggestion? Are
you suggesting to make an Add-in of the code? Do you have any examples I
can
refer to?

Thanks in advance.
sk005


"Peter T" wrote:

If a significant proportion of the file size is the VBA code I'd strongly
recommend you split the code and data into separate workbooks.

Regards,
Peter T

"sk005" wrote in message
...
Hi, I wrote an Excel/VBA application using a lot of modules and class
modules. the file size of this application tempate is 6.8M. It takes
just
over two minute to save to network share and above a minute to save
locally.
Is there any way to improve the saving time? I tried to implement the
Micosoft solution of saving it locally (c:\temp ) mostly and background
copy
to the share drive and then re-opening newly coped file from the share
but
the best I can hope for is about a minute. Is there anyway I can
improve
the
saving time significantly?

Thanks in advance.
sk005