Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just change this line
sRange = "A1:H" & iXrow to: Set sRange = objWS.Range("A1:H" & iXrow) -----Original Message----- Hi, I have a Visual Basic 6 program that output's data to an excell work sheet, but get error when trying to set the page up prior to printing: err 1004: Unable to set the printArea property of the PageSetup class Can someone please help? Many thanks. Dim objXL As Object Dim objWB As Object Dim objWS As Object Set objXL = CreateObject("Excel.Application") Set objWB = objXL.Workbooks.Add Set objWS = objWB.ActiveSheet sRange = "A1:H" & iXrow objWS.PageSetup.PrintArea = sRange objWS.PageSetup.PrintGridlines = True objWS.PageSetup.Orientation = xlLandscape objWS.Range("A1:H1").Interior.ColorIndex = 15 . |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
From VBA's immediate window:
?xlLandscape 2 objWS.PageSetup.Orientation = xlLandscape would become objWS.PageSetup.Orientation = 2 (What was iXrow equal to when you ran it the first time?) Chris H wrote: Alexander, Many thanks for your help I'll give that a go, Any suggestions on the Gridlines & Orientation = xlLandscape? -----Original Message----- Just change this line sRange = "A1:H" & iXrow to: Set sRange = objWS.Range("A1:H" & iXrow) -----Original Message----- Hi, I have a Visual Basic 6 program that output's data to an excell work sheet, but get error when trying to set the page up prior to printing: err 1004: Unable to set the printArea property of the PageSetup class Can someone please help? Many thanks. Dim objXL As Object Dim objWB As Object Dim objWS As Object Set objXL = CreateObject("Excel.Application") Set objWB = objXL.Workbooks.Add Set objWS = objWB.ActiveSheet sRange = "A1:H" & iXrow objWS.PageSetup.PrintArea = sRange objWS.PageSetup.PrintGridlines = True objWS.PageSetup.Orientation = xlLandscape objWS.Range("A1:H1").Interior.ColorIndex = 15 . . -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Page layout - page setup - items disabled | Excel Discussion (Misc queries) | |||
FORMAT EXCEL WORKBOOK (PAGE SETUP) ALL AT ONCE INSTEAD OF BY PAGE | Excel Discussion (Misc queries) | |||
Page Setup when saving a worksheet as a web page | Excel Discussion (Misc queries) | |||
HOW DO I SETUP A PAGE IN EXCEL TO GIVE TOTALS TO ANOTHER PAGE | Excel Worksheet Functions | |||
Under Page Setup the page option of Ledger - for Office XP | Excel Discussion (Misc queries) |