On Jan 22, 7:11 am, BlueWolverine
wrote:
> Hello,
> MS Access/Excel 2003 on XP PRO.
>
> I have a subroutine that outputs a query to an excel file and then formats
> it automatically, and everything works, I get no compile errors, except for
> one little failure.
>
> when I execute the line with the > in front of it is the problem.
>
> With obj_excel 'Excel application
> 'whole bunch of stuff in here
>
> With .activesheet.PageSetup> .PrintTitleRows = "$1:$1"
>
> 'plus other
> end with
>
> 'whole bunch of stuff in here
> end with
>
> this line does not happen. It executes, moves to the next line of code, but
> it does not happen. the print title rows in the output excel file are not
> set. the whole point of writing code like this is to prevent manually
> formatting a document so this irritates the hell out of me, since I may
> output 15 documents like this in a setting.
>
> Any idea why this line of code is not executing?
> Thanks.
>
> --
> BlueWolverine
> MSE - Mech. Eng.
> Go BLUE!
Maybe I can help you follow Douglas' advice. When formatting
worksheets from scratch, I reference each worksheet directly from the
Excel.Application object. For example:
Set wsheet = obj_excel.Worksheets("Sheet1")
wsheet.Name = Format(Date, "mmm") & Format(Date, "yy")
With obj_excel
.DisplayAlerts = False
.Worksheets("Sheet2").Delete
.Worksheets("Sheet3").Delete
.DisplayAlerts = True
End With
James A. Fortune
MPAPoster.Del DeleteThis @FortuneJames.com
>> Stay informed about: CODE for EXCEL output not executing in access - PrintTitle..