How to insert Excel Worksheet Name using Automation in VB Dot Net??

V

Vanessa

Hi
In my VB Dot Net program, I'm using Automation to call Excel worksheet to do
some insert some data.

I have rename my worksheet to a name. eg. "ABC".

How do I insert the worksheet name & Page No to the Footer so that when I
print the worksheet, the name of the worksheet and page number will be
printed out as well?

Regards
Vanessa
 
H

Herfried K. Wagner [MVP]

Hello,

Vanessa said:
In my VB Dot Net program, I'm using Automation to call
Excel worksheet to do some insert some data.

I have rename my worksheet to a name. eg. "ABC".

How do I insert the worksheet name & Page No to the
Footer so that when I print the worksheet, the name of
the worksheet and page number will be
printed out as well?

I think the Excel programmers can help you:

news://news.microsoft.com/microsoft.public.excel.programming

Regards,
Herfried K. Wagner
 
V

Vanessa

Herfried K. Wagner said:
Hello,



I think the Excel programmers can help you:

news://news.microsoft.com/microsoft.public.excel.programming

Regards,
Herfried K. Wagner
 
S

steve

Vanessa,

This code will put "Page #" in the right footer and the sheet tab name in
the center footer

With ActiveSheet.PageSetup
.LeftFooter = "Page & &P"
.CenterFooter = "&A"
End With

You can use the macro Recorder to get other code. But beware that the code
I got for PageSetup was 32 lines and I had to edit it down to 4 lines. This
edit is especially important in this case since PageSetup is a very slow
procedure and bogs down your code.

The other way is to just manually go into PageSetup and set it up.
 
C

Cor

Herr Herfried,
Do you know what is better JavaScript or VB6 I want to try that on my
Asp.net server.
Corina
 
C

Cor

I sometimes get a slight feeling that the best way to get an answer in this
newsgroup is to use a womans name, does not matter if it is
Javasript, Excel, VB2, Asp.net etc. etc.

Of course for real VB.net questions everybody gets a nice answer man or
woman.

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top