MadeleineB
New Member
- Joined
- Sep 23, 2008
- Messages
- 18
I'm trying to set the paper size of a worksheet by using a variable from a cell. (see code below) The variable for how many copies works but the paper size does not. If I use the following code (in green) instead on the code in red it works. HELP!
Worksheets("RAG Summary").PageSetup.PaperSize = xlPaperA3
------------------------------------------------------------------------------------------
Dim MyPaper As String
Dim MySize As String
Dim MyCopy As String
MyPaper = ThisWorkbook.Sheets("Publish").Range("N4")
MySize = "xlPaper" & MyPaper
MyCopy = ThisWorkbook.Sheets("Publish").Range("N6")
Worksheets("RAG Summary").PageSetup.PaperSize = MySize
Sheets(Array("RAG Summary", "Progress")).Select
Sheets("RAG Summary").Activate
'ActiveWindow.SelectedSheets.PrintPreview
ActiveWindow.SelectedSheets.PrintOut Copies:=MyCopy, Collate:=True
Worksheets("RAG Summary").PageSetup.PaperSize = xlPaperA3
------------------------------------------------------------------------------------------
Dim MyPaper As String
Dim MySize As String
Dim MyCopy As String
MyPaper = ThisWorkbook.Sheets("Publish").Range("N4")
MySize = "xlPaper" & MyPaper
MyCopy = ThisWorkbook.Sheets("Publish").Range("N6")
Worksheets("RAG Summary").PageSetup.PaperSize = MySize
Sheets(Array("RAG Summary", "Progress")).Select
Sheets("RAG Summary").Activate
'ActiveWindow.SelectedSheets.PrintPreview
ActiveWindow.SelectedSheets.PrintOut Copies:=MyCopy, Collate:=True