473,395 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
2 5070
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mail2atulmehta | last post by:
Hi, I do not know if this is right place for this, but i need some help. I have a text file, whose values are seprated by a delimiter. I want to open this file in excel, ( not import it) . I have...
6
by: Matthew Wieder | last post by:
I have the following requirements: Build a stand-alone C# application that asks the user to click in a cell in an Excel spreadsheet, and then displays the address of that cell in the C#...
1
by: javzxp | last post by:
Hi I'd like to use C# to open an existing Excel workbook and save each worksheet it contains into a new Excel file. The name of each new Excel file should be the name of the worksheet copied...
8
by: ChrisBowringGG | last post by:
When you use Application.Quit() on an Excel application, there can still be an instance of Excel running, as seen in Task Manager. You can try following the advice on MSDN: ...
1
by: Bernd Muent | last post by:
Hi together, I am using the following code in Visual Basic to open Word or Excel applications: Word: Dim w As Word.Application w = CType(CreateObject("Word.application"), Word.Application)...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
22
by: Howard Kaikow | last post by:
There's a significant problem in automating Excel from VB .NET. Reminds me of a problem I encountered almost 3 years ago that was caused by the Norton Auntie Virus Office plug-in. Can anybody...
2
by: WZ | last post by:
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...
3
by: dan_roman | last post by:
Hi, I developed a script with a nice interface in Tkinter that allows me to edit some formulas and to generate an Excel worksheet with VBA macros within it. The script runs perfectlly in Office...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.