LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Move page breaks programmatically...

I am trying to move page breaks in an Excel spreadsheet programmatically in
..NET, but I keep getting an error.

I am changing page breaks because there is some "heading" data on some rows
that should be kept with it's data, and if the page break occurs right after
the heading, I want to move it before the heading.

My code to change the page break's location is:

_pb.Location = (Excel.Range)_wksht.Cells[int.Parse(_rng.Row.ToString()),
"A"];

_rng.Row = 45
_rng is an Excel.Range object
_pb is one of the HPageBreaks in the spreadsheet

Error reported is:
Error code is -2146827284
Exception from HRESULT: 0x800A03EC.
at System.RuntimeType.ForwardCallToInvokeMember(Strin g memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at Excel.HPageBreak.set_Location(Range )
at STLTrust.Flash.Reports.PrintSpreadsheets(DateTime ReportDate) in
c:\projects\stltrust flash\reports.cs:line 679

Which, obviously, tells me nothing except that I got a COM error when
setting the location.

I have tried using a hard coded row, instead of the one from the _rng
object, since I thought maybe the problem was it wasn't getting the row from
the Range object, but I still got the error. (i.e. _pb.Location =
(Excel.Range)_wksht.Cells[45, "A"];)

If someone could PLEASE tell me what I am doing wrong here, I would really
appreciate it! Thanks!

Theresa Smallwood





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't move my page breaks in Page Break Preview btaft Excel Discussion (Misc queries) 6 April 27th 23 11:49 AM
Move page breaks Judy Excel Discussion (Misc queries) 1 June 23rd 05 11:44 PM
why can't I move page breaks? greensward Excel Discussion (Misc queries) 1 May 2nd 05 10:16 PM
why can't I move page breaks in XP Office greensward Excel Discussion (Misc queries) 0 May 2nd 05 02:38 PM
move page breaks Laura Excel Worksheet Functions 1 March 31st 05 02:16 AM


All times are GMT +1. The time now is 04:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"