Part of it could be related to the fact your using a mixture of early and
late binding to excel. I would suggest using stritly early binding as that
is much faster. Here is how I would do it.
'this is late binding I wouldn't do it this way
oExcel = CreateObject("Excel.Application")
'instead use the new fucntion of the Excel.Application
oExcel = New Excel.Application
Everything else should be the same. Try that and see if it runs any faster.
John
"WZ" <WZ@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
I used the following code to create a workbook and save it in a
webapplication.
dim oExcel As Excel.ApplicationClass
dim oBook As Excel.WorkbookClass
dim obooks As Excel.Workbooks
dim designb As Excel.Workbook
dim osheets As Excel.Sheets
dim result as string
result = "c:\result.xls"
oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
obooks = oExcel.Workbooks
designb = obooks.Open(result)
osheets = designb.Worksheets
.........
designb.save
However, it seems it takes forever to save it.
I tried another method as following, but with the same result.
designb.Close(savechanges:=True)
When I used designb.saveas(path), path is a new directory, it works
fine. I needs to save the file to the same location. Please let me know
what I need to do. Thanks a lot.