Welcome to Windows Help!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

CODE for EXCEL output not executing in access - PrintTitle..

 
   Windows Help (Home) -> Microsoft Access RSS
Next:  Upgrade to Power Point 2010 from Microsoft Office..  
Author Message
BlueWolverine

External


Since: Dec 5, 2008
Posts: 2



(Msg. 1) Posted: Fri Jan 22, 2010 4:11 am
Post subject: CODE for EXCEL output not executing in access - PrintTitleRows
Archived from groups: microsoft>public>access (more info?)

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.

 >> Stay informed about: CODE for EXCEL output not executing in access - PrintTitle.. 
Back to top
Login to vote
Douglas J. Steele

External


Since: Nov 27, 2008
Posts: 61



(Msg. 2) Posted: Fri Jan 22, 2010 7:59 am
Post subject: Re: CODE for EXCEL output not executing in access - PrintTitleRows
Archived from groups: per prev. post (more info?)

I find that when Automating Excel, it's usually a good idea to avoid using
..ActiveSheet, and instead explicitly refer to the sheet you mean.

Take a look at my July, 2005 "Access Answers" column in Pinnacle
Publication's "Smart Access". You can download the column (and sample
database) for free at [URL="http://www.accessmvp.com/DJSteele/SmartAccess.html"]http://www.accessmvp.com/DJSteele/SmartAccess.html[/URL] or
read it online at [URL="http://www.vb123.com/kb/200507_ds_excel.htm"]http://www.vb123.com/kb/200507_ds_excel.htm[/URL]

 >> Stay informed about: CODE for EXCEL output not executing in access - PrintTitle.. 
Back to top
Login to vote
BlueWolverine

External


Since: Dec 5, 2008
Posts: 2



(Msg. 3) Posted: Fri Jan 22, 2010 7:59 am
Post subject: Re: CODE for EXCEL output not executing in access - PrintTitleRows
Archived from groups: per prev. post (more info?)

With obj_worksheet.PageSetup
.PrintTitleRows = "$1:$1"
'.PrintTitleColumns = ""
End With
With .activesheet.PageSetup
.PrintTitleRows = "$1:$1"

end with
I did this, with obj_worksheet=obj_Workbook.sheets("NAME OF SHEET")

IT STILL DOES NOT WORK. HELP!
 >> Stay informed about: CODE for EXCEL output not executing in access - PrintTitle.. 
Back to top
Login to vote
James A. Fortune

External


Since: Dec 2, 2008
Posts: 20



(Msg. 4) Posted: Sat Jan 23, 2010 8:54 pm
Post subject: Re: CODE for EXCEL output not executing in access - PrintTitleRows
Archived from groups: per prev. post (more info?)

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.. 
Back to top
Login to vote
sduis

External


Since: Jan 24, 2010
Posts: 1



(Msg. 5) Posted: Sun Jan 24, 2010 2:25 pm
Post subject: Re: CODE for EXCEL output not executing in access - PrintTitleRows
Archived from groups: per prev. post (more info?)

"BlueWolverine" schreef in bericht

> 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!
 >> Stay informed about: CODE for EXCEL output not executing in access - PrintTitle.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
No code executing in 2007 - I have a 2002 Access Db that works fine in 2002. When I open it in 2007 and save it as a 2007 Db, no code behind any controls executes. I have tried compiling and get no errors. I have also place a stop in my code and it just does not run the code....

Data Access Page for Excel - I have createed a DAP for a database. How can I use this DAP for input data in a Excel worksheet with same fields. Is it possible?

Access 2003, Windows 2000, Export to excel - I have a report which I run on 2 different machines. a windows 2000 and a windows XP. Both have the Access 2003 runtime installed. On the XP machine I have the button to export to excel 2003, but not on the windows 2000 machine. Is there some way to..

Imported data from excel showing as exponential number in .. - I am trying to import a spreadsheet into access from excel. The colums are coming into access as exponential numbers, not the 12 digit numbers I want. I have formatted the cells in excel as both nubmers and text but the same thing happens. I even..

MS Access 2003 (Access 2000 file Format) - Hello, Anyone know why if I have MS Access 2003 installed but all my DBs are in a Access 2000 file format? I noticed in a 2003 Ms Access book I am missing stuff 2003 offers. Thanks!
   Windows Help (Home) -> Microsoft Access All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]