Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Setting paper size as variable for printing custom views

I have a macro which prints a custom view as follows in example 1:

ActiveWorkbook.CustomViews("Main Cover Sheet").Show
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

The print settings for this are set using legal paper. I want to give the
user the choice to switch to letter if they want to. I know I can do this in
code by doing the following in example 2:

ActiveWorkbook.CustomViews("Main Cover Sheet").Show
With ActiveSheet.PageSetup
.PaperSize = xlPaperLetter
End With

What I want to do is have the user choose via an option box. I want to then
pass the choice to a variable in VBA - say "papersize". How do you pass this
variable to the code I already have without repeating all the code in example
2. Can you integrate into the first line of code with a comma (i.e.
Collate:=TRUE, PaperSize: xlPaperLetter). Or do you need the second line?

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PaperSize = xlPaperLetter

Thanks

EM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Setting paper size as variable for printing custom views

1. make your store your "option box" (control) value in the variable
Set your options to be xlPaperLetter and xlPaperLegal
myVar = Control.Value 'Replace Control with correct object

2. Use the variable in place of the xlPaperLetter
.PaperSize = myVar


"ExcelMonkey" wrote:

I have a macro which prints a custom view as follows in example 1:

ActiveWorkbook.CustomViews("Main Cover Sheet").Show
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

The print settings for this are set using legal paper. I want to give the
user the choice to switch to letter if they want to. I know I can do this in
code by doing the following in example 2:

ActiveWorkbook.CustomViews("Main Cover Sheet").Show
With ActiveSheet.PageSetup
.PaperSize = xlPaperLetter
End With

What I want to do is have the user choose via an option box. I want to then
pass the choice to a variable in VBA - say "papersize". How do you pass this
variable to the code I already have without repeating all the code in example
2. Can you integrate into the first line of code with a comma (i.e.
Collate:=TRUE, PaperSize: xlPaperLetter). Or do you need the second line?

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PaperSize = xlPaperLetter

Thanks

EM

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Setting paper size as variable for printing custom views

Sorry, I was a little hasty. Item one should read:

1. Store your "option box" (control) value in the variable and
Set your options to be xlPaperLetter and xlPaperLegal:
myVar = Control.Value 'Replace Control with correct object



"ExcelMonkey" wrote:

I have a macro which prints a custom view as follows in example 1:

ActiveWorkbook.CustomViews("Main Cover Sheet").Show
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

The print settings for this are set using legal paper. I want to give the
user the choice to switch to letter if they want to. I know I can do this in
code by doing the following in example 2:

ActiveWorkbook.CustomViews("Main Cover Sheet").Show
With ActiveSheet.PageSetup
.PaperSize = xlPaperLetter
End With

What I want to do is have the user choose via an option box. I want to then
pass the choice to a variable in VBA - say "papersize". How do you pass this
variable to the code I already have without repeating all the code in example
2. Can you integrate into the first line of code with a comma (i.e.
Collate:=TRUE, PaperSize: xlPaperLetter). Or do you need the second line?

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PaperSize = xlPaperLetter

Thanks

EM

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing on legal paper in landscape setting grandmax2 Excel Discussion (Misc queries) 2 January 8th 09 09:12 PM
custom paper size setting Boyd New Users to Excel 4 August 26th 05 06:14 AM
Is there a way to set up a custom paper size? rkstorey Excel Discussion (Misc queries) 3 February 3rd 05 02:07 AM
How do you set a custom paper size in Excel? Bambi41 Excel Discussion (Misc queries) 1 January 25th 05 02:57 AM
custom paper size Mike Kim Excel Programming 3 October 19th 03 12:22 AM


All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"