473,772 Members | 2,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export Data to Excel

I'm trying to export data to an Excel worksheet. I can export the data in
the cell values perfectly.

I need the code to change a header and footer for the worksheet, not for the
columns.

Is this possible? If so, I really need the code immediately.

Thank you,
Elena
Mar 13 '06 #1
6 4066
"Elena" <El***@discussi ons.microsoft.c om> schrieb
I'm trying to export data to an Excel worksheet. I can export the
data in the cell values perfectly.

I need the code to change a header and footer for the worksheet, not
for the columns.

Is this possible? If so, I really need the code immediately.

Have a look at the Excel object model in the Excel documentation. You can
use Excel via COM interop by setting a reference to the "Microsoft Excel x.y
object library" on the COM folder on the "add references" dialog.

See also:
http://support.microsoft.com/kb/301982/en-us

Armin

Mar 13 '06 #2
I'm not sure what you mean. I looked at the article you pointed me to and I
only see ranges or cells. This is the header/footer outside of the cells and
on the sheet itself. I'm sorry if I wasn't clear before.

I already have the library referenced. You need it to be able to export
anything to Excel.

"Armin Zingler" wrote:
"Elena" <El***@discussi ons.microsoft.c om> schrieb
I'm trying to export data to an Excel worksheet. I can export the
data in the cell values perfectly.

I need the code to change a header and footer for the worksheet, not
for the columns.

Is this possible? If so, I really need the code immediately.

Have a look at the Excel object model in the Excel documentation. You can
use Excel via COM interop by setting a reference to the "Microsoft Excel x.y
object library" on the COM folder on the "add references" dialog.

See also:
http://support.microsoft.com/kb/301982/en-us

Armin

Mar 13 '06 #3
"Elena" <El***@discussi ons.microsoft.c om> schrieb
I'm not sure what you mean. I looked at the article you pointed me
to and I only see ranges or cells. This is the header/footer
outside of the cells and on the sheet itself. I'm sorry if I wasn't
clear before.

I already have the library referenced. You need it to be able to
export anything to Excel.

I didn't know how you exported it to an Excel file and that you already have
a reference to Excel and know how to use it. Therefore the link. Though,
have a look at the Excel object model in the Excel documentation. See also
the appropriate microsoft.publi c.excel.* group.

Armin

"Armin Zingler" wrote:
"Elena" <El***@discussi ons.microsoft.c om> schrieb
> I'm trying to export data to an Excel worksheet. I can export the
> data in the cell values perfectly.
>
> I need the code to change a header and footer for the worksheet, not
> for the columns.
>
> Is this possible? If so, I really need the code immediately.

Have a look at the Excel object model in the Excel documentation. You can
use Excel via COM interop by setting a reference to the "Microsoft Excel
x.y
object library" on the COM folder on the "add references" dialog.

See also:
http://support.microsoft.com/kb/301982/en-us


Mar 13 '06 #4
Armin,

Let me try and be more clear:

I need the VB.NET code to change the header/footer of an Excel spread sheet.
I am doing it through a VB application. I can change the ranges/cell values
using code, but I do not know how to change things outside of the cell
ranges. I will try and post in an Excel group, but i do not need to change
it in a worksheet, I need to change it through a VB application. For
example, I am using this code to change values in certain cells:

'open excel document
Dim ThisApplication As Excel.Applicati on
ThisApplication = New Excel.Applicati on
' Start Excel and get Application object.
ThisApplication = CreateObject("E xcel.Applicatio n")
ThisApplication .Visible = True
'connection for package
Dim Wb As Excel.Workbook =
ThisApplication .Workbooks.Open ("C:\CDRLReview .xls")
Dim CDRLWs As Excel.Worksheet = Wb.Worksheets(1 )
Dim DIDWs As Excel.Worksheet = Wb.Worksheets(2 )

DIDWs.Range("a2 ").Value = "There is no DID associated with this
CDRL."
DIDWs.Range("a2 ").Font.ColorIn dex = 3
DIDWs.Range("a2 ").Font.Bol d = True

This code works! Yet, I need to change the Worksheet's header in the same
fashion.

I need to know if i can do something like:

DIDWs.Header.Va lue = <~~ I don' t know what the correct code is, it's just
an example.
~Elena
"Armin Zingler" wrote:
"Elena" <El***@discussi ons.microsoft.c om> schrieb
I'm not sure what you mean. I looked at the article you pointed me
to and I only see ranges or cells. This is the header/footer
outside of the cells and on the sheet itself. I'm sorry if I wasn't
clear before.

I already have the library referenced. You need it to be able to
export anything to Excel.

I didn't know how you exported it to an Excel file and that you already have
a reference to Excel and know how to use it. Therefore the link. Though,
have a look at the Excel object model in the Excel documentation. See also
the appropriate microsoft.publi c.excel.* group.

Armin

"Armin Zingler" wrote:
"Elena" <El***@discussi ons.microsoft.c om> schrieb
> I'm trying to export data to an Excel worksheet. I can export the
> data in the cell values perfectly.
>
> I need the code to change a header and footer for the worksheet, not
> for the columns.
>
> Is this possible? If so, I really need the code immediately.
Have a look at the Excel object model in the Excel documentation. You can
use Excel via COM interop by setting a reference to the "Microsoft Excel
x.y
object library" on the COM folder on the "add references" dialog.

See also:
http://support.microsoft.com/kb/301982/en-us


Mar 13 '06 #5
"Elena" <El***@discussi ons.microsoft.c om> schrieb
Armin,

Let me try and be more clear:

I need the VB.NET code to change the header/footer of an Excel
spread sheet. I am doing it through a VB application. I can change
the ranges/cell values using code, but I do not know how to change
things outside of the cell ranges. I will try and post in an Excel
group, but i do not need to change it in a worksheet, I need to
change it through a VB application. For example, I am using this
code to change values in certain cells:

I do understand your concerns. I don't have an answer because this is a
question related to the Excel automation object model (that I don't know
that good), not a question about VB.Net. You obviously don't have a
problem in handling VB.Net but handling the Excel object model. In other
words, if you did it in C#, you would have the same question.
Armin

Mar 13 '06 #6
"Elena" <El***@discussi ons.microsoft.c om> schrieb
This code works! Yet, I need to change the Worksheet's header in
the same fashion.

I need to know if i can do something like:

DIDWs.Header.Va lue = <~~ I don' t know what the correct code is,
it's just an example.

Start Excel, start recordin a macro, change the header, stop recording,
have a look at the generated macro source code. You can apply the same cod
in VB.Net then.
Armin

Mar 13 '06 #7

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

Similar topics

1
5035
by: Matt | last post by:
I have an ASP page that calls ASP routines that I created that execute a database query and return the results to a recordset. I then iterate through the recordset and display the data in a table. Before I iterate through the recordset I instruct the browser that the content type is Excel using the following line: (Response.ContentType = "application/vnd.ms-excel") This works fine with Excel 2003 but with older versions (I tested Excel...
4
15013
by: Jiro Hidaka | last post by:
Hello, I would like to know of a fast way to export data source data into an Excel sheet. I found a way from C# Corner(Query Tool to Excel using C# and .NET) which is a neat little way of exporting dataset data to an excel using the Excel COM object. This works fine but the problem is its pretty darn slow when exporting large
13
13241
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" HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=ABC.xls") HttpContext.Current.Response.Write(strHTML) HttpContext.Current.Response.End() However when the user tries to save it the Default File Type is Web Page(*.htm; *.html)
1
7209
by: JawzX01 | last post by:
Hello All, First, thank you for any help you can provide. I'm trying to do a simple export to excel. I've used the classic code that is all over the internet, and of course it worked without a problem. The problem is that I want to add text above the data grid in the excel sheet. The text already exists on the web page in various panels (there is different text depending on the parameters of the datagrid
1
9778
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm having I'd be most appreciative. The database is already constructed, I'm just wanting to export the data to an excel file. In short, I'm hoping to export two Tables (or queries...not sure which to use - they both seem to have the same data) in...
1
10505
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am trying to export to Excel using a command in an Access Form. RowID strFY AccountID CostElementWBS 1 2008 1 7 2 2008 1 7 I want to...
7
28903
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can actually do something more with. This code shows you how to display data from your database and then how to give that data to the user in the form of a useable Excel spreadsheet which they can then take away and play with themselves. The way I have shown...
3
7162
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this file but save it as an excel file. The data in this excel file will be imported into an Access database. The
2
6414
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the method.... it creates 6 sheets # region Namespaces using System;
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10039
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7461
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.