Page Setup
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
.
|