473,406 Members | 2,356 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,406 software developers and data experts.

Excel ASP Save

I hope this is the right area to post this, and I appoligize if it isn't
in advance.

I've spent the last few days trying to figure out what I'm doing wrong
in this code. What I'm doing is that I'm opening an excel file,
changing the header and then trying to save and close the file. Instead
when I run it, the web page hangs.

Sub Headers()
Dim xlapp ' Our Excel App
Dim wb ' Our Workbook within the Excel App
Dim ws ' Our Worksheet within the Workbook

Set xlapp = Server.CreateObject("Excel.Application")
Set wb = xlapp.Workbooks.open("\\server\path\test.xls")
Set ws = wb.Worksheets(1)

ws.pagesetup.LeftHeader="Some Text"

wb.Save()

Set wb = Nothing
xlapp.Quit
Set xlapp = Nothing
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
1 1298
what is xlapp after the create call? are you testing for null? If you are,
then you need to check permissions to access the test.xls file.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"yosh o" <fa**@yahoo.com> wrote in message
news:OR**************@TK2MSFTNGP12.phx.gbl...
I hope this is the right area to post this, and I appoligize if it isn't
in advance.

I've spent the last few days trying to figure out what I'm doing wrong
in this code. What I'm doing is that I'm opening an excel file,
changing the header and then trying to save and close the file. Instead
when I run it, the web page hangs.

Sub Headers()
Dim xlapp ' Our Excel App
Dim wb ' Our Workbook within the Excel App
Dim ws ' Our Worksheet within the Workbook

Set xlapp = Server.CreateObject("Excel.Application")
Set wb = xlapp.Workbooks.open("\\server\path\test.xls")
Set ws = wb.Worksheets(1)

ws.pagesetup.LeftHeader="Some Text"

wb.Save()

Set wb = Nothing
xlapp.Quit
Set xlapp = Nothing
End Sub

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Vikram | last post by:
Hi, Given below is my task. An user can open the xls file from my website (loaded on the top frame). After filling the Excel, he can click a send button at the bottom frame. By clicking the...
3
by: VbUser25 | last post by:
hi.. i have a form i accept some user inputs in the form. there is a link on the form from where i open the excel file in the same browser (not in a new page...simply using a href. i am also...
2
by: Bryan Harrington | last post by:
Hello all.. I'm working on some reports, and have added the ability to "download" the reports to excel. Not a big deal, fairly straight forward. However, PHB wants to be able to create some pivot...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
2
by: Steve Chatham | last post by:
I use the following code: Private Sub RbtnExport_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbtnExport.SelectedIndexChanged Dim sFile As String =...
7
by: Alain \Mbuna\ | last post by:
Hi everybody. In my program I have some data that is calculated after some input from the user. I have written some code that opens an Excel workbook, with 5 worksheets and the calculated data...
6
by: Michael Groeger | last post by:
Hi, I have an aspx page which generates an excel document and transfers it to the browser as attachment. Normally, once the document is transferred the open save dialog prompts to open or save...
13
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"...
2
by: iloveprincess | last post by:
Hi, I'm developing windows application using VB.Net 2005. I would like to send 'save' message using 'SendMessage' API to the excel appication. I've already got a handle of the excel window with...
2
by: DPK | last post by:
Hello friends!!! I made a prog. to make the excel. It is running well but when it saves the excel file it open the save dialog box to save the file becasue I am using SAVE function here instead of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.