Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having trouble with an automation project that I am working on. I
am generating a report in a spreadsheet. Originally I attempted to do it in Access, but it did not provide me enough flexibility to accomplish what I was looking to do. The report is an old report that was manually created in Excel and they wanted to format to remain the same, but automate it. Everything has been going great up until this one bit of code... Essentially the report is in a format something like this: \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\ Type 1 | header 1 | header 2 | header 3 | | details | details | details | ---------------------------------------------- subtotals Type 2 | header 1 | header 2 | header 3 | | details | details | details | ---------------------------------------------- subtotals | header 1 | header 2 | header 3 | grand totals \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\ For most of my organizational units this all fits on one page, but for a few it does not. When it does not I want to drop the Type 2 section to its own page. The code below is what I am using to accomplish this and it is working most of the time. I am randomly getting the error that is listed in the subject line of this message. If BotRow 13 Then BotRow = BotRow + 3 Set xlRng = xlWs.Range("A" & BotRow) xlRng.Select xlWs.HPageBreaks.Add Befo=ActiveCell <<<< Error on this line End If Any ideas as to what could be causing this error? It does not seem to matter if Excel is already open or if all instances are closed. Is there another way to insert a page break at a given point? I am using Access 2002 SP-1 and Excel 2003 SP-3 on a WinXP machine. If you need more info to come up with an answer just let me know. Jamey Weare Business Analyst Florida Power & Light |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Charts.Add error '1004' Method 'Add' of object 'Sheets' failed | Charts and Charting in Excel | |||
Intermittent Error - Method 'Add' of object 'HPageBreaks' failed | Excel Worksheet Functions | |||
Method 'Union' of object '_Global' failed error | Excel Programming | |||
HELP - 'Add' of object 'CommandBarControls' failed | Excel Discussion (Misc queries) | |||
Method 'Add' of object 'CommandBarControls' failed | Excel Discussion (Misc queries) |