473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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 2756

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"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...

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.