Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Amy Amy is offline
external usenet poster
 
Posts: 165
Default Invalid index in foreach(HPageBreak hpb in sheet.HPageBreaks)

My program got the following exception while parsing some excel files (they
usually contain some manual page breaks):
Exception from HRESULT: 0*8002000B <DISP_E_BADINDEX

I used
sheet.HPageBreaks.Count
found it contains 5 objects...
my program can get the first two objects successfully, how ever, it cannot
load the left.

Does anyone know why?
Thanks for any comments.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Invalid index in foreach(HPageBreak hpb in sheet.HPageBreaks)

http://support.microsoft.com/kb/210663/en-us
You receive an"Subscript out of range" error message when you use
HPageBreaks or VPageBreaks.Location in Excel


--
Regards,
Tom Ogilvy

"Amy" wrote in message
...
My program got the following exception while parsing some excel files
(they
usually contain some manual page breaks):
Exception from HRESULT: 0*8002000B <DISP_E_BADINDEX

I used
sheet.HPageBreaks.Count
found it contains 5 objects...
my program can get the first two objects successfully, how ever, it cannot
load the left.

Does anyone know why?
Thanks for any comments.



  #3   Report Post  
Posted to microsoft.public.excel.programming
Amy Amy is offline
external usenet poster
 
Posts: 165
Default Invalid index in foreach(HPageBreak hpb in sheet.HPageBreaks)

Thanks Tom..
My problem is another issue...the program throws exception when it execute
HPageBreak hpb = sheet.HPageBreaks[i];

Usually, I call ResetAllPageBreaks(); before I get the page breaks. If I
dont reset them, the program works well.

"Tom Ogilvy" wrote:

http://support.microsoft.com/kb/210663/en-us
You receive an"Subscript out of range" error message when you use
HPageBreaks or VPageBreaks.Location in Excel


--
Regards,
Tom Ogilvy

"Amy" wrote in message
...
My program got the following exception while parsing some excel files
(they
usually contain some manual page breaks):
Exception from HRESULT: 0*8002000B <DISP_E_BADINDEX

I used
sheet.HPageBreaks.Count
found it contains 5 objects...
my program can get the first two objects successfully, how ever, it cannot
load the left.

Does anyone know why?
Thanks for any comments.




Reply
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
ForEach statement problem excelnut1954 Excel Programming 2 March 31st 06 10:34 PM
Renamed invalid sheet name Angela Excel Discussion (Misc queries) 7 February 17th 06 03:18 PM
Runtime Error 381 Couldn't set list property, invalid array index Newbillian Excel Programming 2 June 17th 04 11:25 AM
Runtime Error 381 Couldn't set list property, invalid array index Newbillian Excel Programming 0 June 16th 04 11:28 PM
ForEach procedure adding values Mats Westin Excel Programming 4 February 12th 04 07:30 AM


All times are GMT +1. The time now is 06:04 AM.

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"