473,466 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Excel PageBreaks from .Net

Has anyone created HPageBreaks or VPageBreaks from their Application for Excel. I use Excel as my reporting tool for all of my Applications, and have been trying to add a new or move an existing pagebreak. But can not get code to work correctly. I have pasted some code that works up to the page break. If someone could 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
Jul 21 '05 #1
1 2757

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

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
9
by: Gambit | last post by:
I have had no luck in finding a good article that covers this exact issue, so here I go! I've made a Datagrid in C# within ASP.NET. So now on the client side they get a table. Now this table is...
0
by: Bill S | last post by:
I am trying to add a HpageBreak in an Application that use Excel for my reporting format. But have run into a wall. If I can move the existing pagebreak that would be ok. I have pasted some code. ...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
2
by: Bagpuss | last post by:
Can anyone help me? I am using VB.NET to output data to an Excel 2002 spreadsheet, this works fine. I would like to know how to change the sheet names and output to a named worksheet and...
0
by: Bill S | last post by:
Has anyone created HPageBreaks or VPageBreaks from their Application for Excel. I use Excel as my reporting tool for all of my Applications, and have been trying to add a new or move an existing...
1
by: Bill S | last post by:
Has anyone created HPageBreaks or VPageBreaks from their Application for Excel. I use Excel as my reporting tool for all of my Applications, and have been trying to add a new or move an existing...
4
by: sadc1986 | last post by:
How does one introduce multiple worksheets in a excel using Xslt Transforms my code... Please suggest <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.