Edward Zuris
edzedz at comcast.net
Sat Nov 14 11:49:50 CST 2009
Just tried this and it works too. .HPageBreaks.Add Before:=ExcelwBook.WorkSheets(sSheet).Cells(lRow + 1, 6) -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Saturday, November 14, 2009 4:47 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Problem with Access VBA makes Excel Orphan Hi Stuart I think I read somewhere that .Sheets is considered "legacy" or should be reserved for graphs, and for worksheets it should read: .HPageBreaks.Add Before:=ExcelwBook.WorkSheets(sSheet).Cells(lRow + 1, 6). /gustav >>> stuart at lexacorp.com.pg 14-11-2009 00:22 >>> .HPageBreaks.Add Before:=Cells(lRow + 1, 6) There's your unqualified reference. Change it to: .HPageBreaks.Add Before:=ExcelwBook.sheets(sSheet).Cells(lRow + 1, 6). -- Stuart -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com