By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,425 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

Excel Format

P: 46
Hi All

I have a button in access application which will export the data from the table to te excel.Now what i want is that, i need the header columns in the excel file need to be formatted to bold.How can i do this.This is my code but in the second line i am getting error saying "Application object not defined".
Can any one help.Thanks in advance

DoCmd.OutputTo acOutputQuery, "ExportDailySheetToExcel", acFormatXLS, "ExportDailySheetToExcel.xls", True
the first line code exports to excel , the second line i used to format the excel headers.What is the problem with below line

Range("A1:Z1").Font.Bold = True
Dec 13 '07 #1
Share this Question
Share on Google+
6 Replies


Rabbit
Expert Mod 10K+
P: 12,396
You have no excel application open.

Look at application automation.
Dec 13 '07 #2

P: 46
Hi

Thanks for the reply.but i have excel file application open with my first statement itself.
DoCmd.OutputTo acOutputQuery, "ExportDailySheetToExcel", acFormatXLS, "ExportDailySheetToExcel.xls", True

the above stmts creates the excel file named ExportDailySheetToExcel
now i want the headers of that excel file need to be formated
Please help me.

Thanks in advance

You have no excel application open.

Look at application automation.
Dec 14 '07 #3

Rabbit
Expert Mod 10K+
P: 12,396
Hi

Thanks for the reply.but i have excel file application open with my first statement itself.
DoCmd.OutputTo acOutputQuery, "ExportDailySheetToExcel", acFormatXLS, "ExportDailySheetToExcel.xls", True

the above stmts creates the excel file named ExportDailySheetToExcel
now i want the headers of that excel file need to be formated
Please help me.

Thanks in advance
No, you don't have an excel application open.

OutputTo creates an excel document but it does not keep open the excel application. It may not even need to open an excel application. And even if it did, it does not return an application object for you to use.
Dec 14 '07 #4

P: 46
Hi
Thanks for your valuable comments.So please suggest what will be code to attain my objective..

on button click event
i have this code

DoCmd.OutputTo acOutputQuery, "ExportDailySheetToExcel", acFormatXLS, "ExportDailySheetToExcel.xls", True
now what code should i write to attain my objective

Thanks in advance

Dilip



No, you don't have an excel application open.

OutputTo creates an excel document but it does not keep open the excel application. It may not even need to open an excel application. And even if it did, it does not return an application object for you to use.
Dec 17 '07 #5

Rabbit
Expert Mod 10K+
P: 12,396
Read the application automation tutorial linked above. That will get you started.
Dec 17 '07 #6

P: 46
Thanks for that..I will surely go with automation link if i face any difficult will surely post you


Read the application automation tutorial linked above. That will get you started.
Dec 18 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.