Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server exception error 1

Status
Not open for further replies.

vba317

Programmer
Joined
Mar 5, 2009
Messages
708
Location
US
I am running an access 97 database. I am getting a server exception error on the line .HPage breaks.add Before:ActiveCell. Highlighted in Blue. Any help would be appreciated.

Code:
 ' *** ADD PAGE BREAK
                If Not rst.EOF Then
                    If (iPageBreakCount = 2) Then
                        With goXL.Sheets("Executive Summary")
                            .Cells(iRow, 1).Select
               [Blue]       .HPageBreaks.Add Before:=ActiveCell  [/Blue]
                        End With
                        iPageBreakCount = 0
                    End If
                End If
            Next Z
        End If
        rst.Close
        Set rst = Nothing
 
I'd use this:
.HPageBreaks.Add Before:=[!].[/!]ActiveCell

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Furthermore, why select ?
Code:
With goXL.Sheets("Executive Summary")
  .HPageBreaks.Add Before:=.Cells(iRow, 1)
End With

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Furthermore, why With?
[tt]
goXL.Sheets("Executive Summary").HPageBreaks.Add Before:=.Cells(iRow, 1)
[/tt]

:-)

Have fun.

---- Andy
 
Andy, without With, you should write this:
goXL.Sheets("Executive Summary").HPageBreaks.Add Before:=goXL.Sheets("Executive Summary").Cells(iRow, 1)
 
Ooops, sorry. Missed that one [blush]

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top