Excel "HPageBreak" crashes

F

Flab

A previous posting listed the following:
--------------------------------------------------------
PageBreakRow = i + j - 2 (Pagebreak contains a
positive value after this)
Rows(PageBreakRow).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add
Before:=ActiveCell
When the above VB is executed I get a failure:
Run-time error '-2147417848 (80010108)' Method 'Add' of
object 'HPageBreaks' failed.
next message
The instruction at "0x77fcc453" referenced
at "0x00000000". The memory could not be "written".

--------------------------------------------------------
I've been running a macro in Excel 2000 for several months now.
Recently my clients upgraded to Win XP and Excel 2000 (previously they
were on Excel 97). Now I am getting a similar error. Yet the exact
same piece of code runs fine on my machine.

As a workaround to this issue, in the above code put this:

-----------------------------
Dim intHack as Integer
' It appears the HPageBreaks is not properly initialized sometimes
' so this is a workaround for initializing it
intHack = ActiveWindow.SelectedSheets.HPageBreaks.Count
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
-----------------------------------------

That seems to have corrected my issue. I will note however, that the
client of mine that is having this issue does NOT have Office 2000 SP3
applied (and I have it applied to my machine and don't get this
issue). I am having them apply this patch to see if it corrects the
problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top