View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Elena Elena is offline
external usenet poster
 
Posts: 43
Default VB. NET Code to Change Excel Worksheet Header/Footer.

I need the VB.NET code to change the header/footer of an Excel spread sheet,
ASAP.
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.Application
ThisApplication = New Excel.Application
' Start Excel and get Application object.
ThisApplication = CreateObject("Excel.Application")
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.ColorIndex = 3
DIDWs.Range("a2").Font.Bold = 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.Value = <~~ I don' t know what the correct code is, it's just
an example.

Thanks in Advance.
~Elena