467,219 Members | 1,462 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,219 developers. It's quick & easy.

How to save an excel workbook in a web application

WZ
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.
Jul 21 '05 #1
  • viewed: 4837
Share:
2 Replies
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.

Jul 21 '05 #2

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.


User submitted from AEWNET (http://www.aewnet.com/)
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by mail2atulmehta@yahoo.com | last post: by
6 posts views Thread by Matthew Wieder | last post: by
1 post views Thread by javzxp@hotmail.com | last post: by
8 posts views Thread by ChrisBowringGG@gmail.com | last post: by
1 post views Thread by Bernd Muent | last post: by
14 posts views Thread by pmud | last post: by
22 posts views Thread by Howard Kaikow | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.