By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,570 Members | 970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,570 IT Pros & Developers. It's quick & easy.

How to save an excel workbook in a web application

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a

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.