Bill,
I am working on a similar problem, but I think I see your problem righ
off the bat. Here is code that I think should work for you.
oWB = oXL.Workbooks.Add
oSheet = oWB.ActiveSheet
With oSheet
..PageSetup.PrintArea = ("a1:p30")
..DisplayPageBreaks = True
'item = .HPageBreaks.Count()
..HPageBreaks.Add .Range("Q30")
End With
As you can see, the Add method of the HPageBreaks Collection requires
Range object, not just an address. Hope this helps.
Bill S wrote:
*Has anyone created HPageBreaks or VPageBreaks from their Applicatio
for Excel. I use Excel as my reporting tool for all of m
Applications, and have been trying to add a new or move an existin
pagebreak. But can not get code to work correctly. I have
pasted some code that works up to the page break. If someone coul
help me or post back some code that works. Thanks
oWB = oXL.Workbooks.Add
oSheet = oWB.ActiveSheet
With oSheet
..PageSetup.PrintArea = ("a1:p30")
..DisplayPageBreaks = True
'item = .HPageBreaks.Count()
..HPageBreaks.Add("Q30")
End With
-
billwai
-----------------------------------------------------------------------
Posted via
http://www.mcse.m
-----------------------------------------------------------------------
View this thread:
http://www.mcse.ms/message775101.htm