Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do page setup in an excel spreadsheet through VB 2

Status
Not open for further replies.

cassidybklyn

Programmer
Apr 23, 2007
82
US
Hello everyone,
Please could someone give me a little directive on how to a page setup in excel using vb code:
Example:
I need to set the Margin for the spreadsheet, gridline, repeat headers, etc.

Thanks.
C.
 



Hi,

Turn on your macro recorder and have at, doing your Page Setup.

Post back with your code if you meed help generalizing & customizing.

Skip,

[glasses] [red][/red]
[tongue]
 
Hi Skip,
I need the code to do the spreadsheet page setup from VB, just like I was doing the sort and couunt
Thanks.
C.
 
I need the code
Again, start from the code generated by the macrorecorder when you do the spreadsheet page setup manually.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 




Cassidy,

Either you reference the help for Excel Page Setup or you open Excel, turn on the macro recorder and record doing a Page Setup. YOU need to have the basic code. It's a dirty job, but SOMEONE has to do it! ;-)

Post back with your code and you'll get lot of help from the plethora of experts here.

Skip,

[glasses] [red][/red]
[tongue]
 
Good morning Skip,
I've been able to do the page setup: Like so:
With PageSetup
.Oder =
.Orientation =
.LeftMargin =
.RightMargin =
etc....

It's working fine.

What I haven't figured out yet is how to get the spreadsheet header labels to print at every page.

Such as "repeat header"
Any clue?
Silly question; I know you got the clue.

 


In the Page Setup dialog, on the Sheet Tab is where you want to look.

Skip,

[glasses] [red][/red]
[tongue]
 




...and the only reason I'm giving you the procedural approch, is because this is the method that I would use to get the code, of course, using the macro recorder.

Skip,

[glasses] [red][/red]
[tongue]
 
where/how do I access this macro recorder? In the excel spreadsheet or vb environment. Really haven't explored this area before.
Thanks.
Cassidy
 
where/how do I access this macro recorder
I already gave you this info 9 May 07 16:28
thread707-1365735

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks Skip. I got it. I already recorded the macro and it's exactlyl what I was looking for.
You the best... Man.
Cassidy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top