I have succesfully exported an Access report to Excel and then opened it, now i want to format it: - Private Sub Command2_Click()
-
-
Dim Date1
-
Dim stReportAddress As String
-
-
Date1 = Format(Date, "dd-mm-yyyy")
-
stReportAddress = "c:\my documents\siobhan\Employer Funding Report - By Employer (" & Date1 & ").xls"
-
-
'Export Report
-
DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", acFormatXLS, stReportAddress
-
-
'Open Report
-
Application.FollowHyperlink stReportAddress
-
-
End Sub
Not sure how to perform the formatting now it is open...
I basically want to resize all the columns, create a header and place a few cells in bold.
Take resizing the columns, i know the code from the excel document would be: - Cells.Select
-
Cells.EntireColumn.AutoFit
I'm just not sure how to prefix it as simply putting that code in doesn't work.
Any ideas out there?????
6 8983
I have succesfully exported an Access report to Excel and then opened it, now i want to format it: - Private Sub Command2_Click()
-
-
Dim Date1
-
Dim stReportAddress As String
-
-
Date1 = Format(Date, "dd-mm-yyyy")
-
stReportAddress = "c:\my documents\siobhan\Employer Funding Report - By Employer (" & Date1 & ").xls"
-
-
'Export Report
-
DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", acFormatXLS, stReportAddress
-
-
'Open Report
-
Application.FollowHyperlink stReportAddress
-
-
End Sub
Not sure how to perform the formatting now it is open...
I basically want to resize all the columns, create a header and place a few cells in bold.
Take resizing the columns, i know the code from the excel document would be: - Cells.Select
-
Cells.EntireColumn.AutoFit
I'm just not sure how to prefix it as simply putting that code in doesn't work.
Any ideas out there?????
Just subscribing to this unanswered Thread, will get back to you later on, hopefully with an answer. (LOL).
I have succesfully exported an Access report to Excel and then opened it, now i want to format it: - Private Sub Command2_Click()
-
-
Dim Date1
-
Dim stReportAddress As String
-
-
Date1 = Format(Date, "dd-mm-yyyy")
-
stReportAddress = "c:\my documents\siobhan\Employer Funding Report - By Employer (" & Date1 & ").xls"
-
-
'Export Report
-
DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", acFormatXLS, stReportAddress
-
-
'Open Report
-
Application.FollowHyperlink stReportAddress
-
-
End Sub
Not sure how to perform the formatting now it is open...
I basically want to resize all the columns, create a header and place a few cells in bold.
Take resizing the columns, i know the code from the excel document would be: - Cells.Select
-
Cells.EntireColumn.AutoFit
I'm just not sure how to prefix it as simply putting that code in doesn't work.
Any ideas out there?????
The following will be more than enough to get you on the right track: -
'The following code will open an Excel Spreadsheet via Automation,resize all Columns
-
'in the Worksheet, set the Size and Bold attributes for a specific Cell, then Exit
-
'while saving the changes
-
-
Dim Date1 As Date, strReportAddress As String
-
Dim objActiveWkb As Object, appExcep As Object
-
-
Set appExcel = CreateObject("Excel.Application")
-
appExcel.Visible = False
-
-
appExcel.Application.Workbooks.Open ("C:\Test\TestReport.xls")
-
-
Set objActiveWkb = appExcel.Application.ActiveWorkbook
-
-
With objActiveWkb
-
.Worksheets(1).Cells.Select
-
.Worksheets(1).Cells.EntireColumn.AutoFit
-
.Worksheets(1).Cells(5, 3).Font.Size = 14
-
.Worksheets(1).Cells(5, 3).Font.Bold = True
-
End With
-
-
objActiveWkb.Close savechanges:=True
-
-
appExcel.Application.Quit
-
-
Set objActiveWkb = Nothing: Set appExcel = Nothing
Thanks!! just what i was after, and no need for hyperlink to open the excel document.
One other question though.....(sorry!)
When performing the save it tells me that the file "is a Microsoft Excel 5.0/95 Workook. Do you want to overwrite it with the latest Excel format?"
I presume this has something to do with when the report is exported..... though i'm not sure where. I am running Office 2003 and don't understand why it would export the file in an older format. - DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", acFormatSNP, SnpRptAddressByEmpl
I have looked into acFormat but XLS is the only excel format.
The way i see it i can either somehow try to export the file in the latest format, or i can automatically have the code say "Yes" when the pop up appears.
Can you help?
Thanks!! just what i was after, and no need for hyperlink to open the excel document.
One other question though.....(sorry!)
When performing the save it tells me that the file "is a Microsoft Excel 5.0/95 Workook. Do you want to overwrite it with the latest Excel format?"
I presume this has something to do with when the report is exported..... though i'm not sure where. I am running Office 2003 and don't understand why it would export the file in an older format. - DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", acFormatSNP, SnpRptAddressByEmpl
I have looked into acFormat but XLS is the only excel format.
The way i see it i can either somehow try to export the file in the latest format, or i can automatically have the code say "Yes" when the pop up appears.
Can you help?
Try substituting "MicrosoftExcelBiff8(*.xls)" for acFormatXLS
Unfortunately that has made no difference...
Unfortunately that has made no difference...
You got me stumped for now, sorry.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nicolae Fieraru |
last post by:
Hi All,
I have an access query which retrieves some record. I can export the results
of it as an excel document, using the function TransferText. What I actually
need is to export the query as a...
|
by: Marcus |
last post by:
I am using the following command to open a query in Excel:
DoCmd.OutputTo acOutputQuery, "qryTest", acFormatXLS, , True
The problem is that the code creates an Excel 97 file. Is there a way...
|
by: BerkshireGuy |
last post by:
I have the following Access code that exports to Excel, inserts a
title, changes the color of the title, and then changes the format of
several columns to currency.
The following code sometimes...
|
by: Mansi |
last post by:
I need to do some research on how to use excel automation from c#. Does
anyone know of any good books related to this subject?
Thanks.
Mansi
|
by: Bon |
last post by:
Hello all
I create a form with three buttons in MS Access 2000. They are Open
Excel Template, Save Draft and Save Final. When I click the Open Excel
Template button, the Excel template will be...
|
by: musicloverlch |
last post by:
I have a problem. I have an Access 2003 report that contains a number
of Word and Excel objects with fancy formatting and spreadsheets, etc.
I have about 20 records that I am having the database...
|
by: toffee |
last post by:
Hi all,
I created a little button which when clicked will run a query on mysql db
and output the results as an excel spreadsheet.
I do this by setting the header as application excel. All works...
|
by: dima69 |
last post by:
Biff format is defined as default format for copying data from Access to Excel (under registry key ...\Access\Clipboard Formats). This format has a known problem as numbers are pasted as text using...
|
by: Joe Humburg |
last post by:
Hi everyone,
Looking for some help or ideas, on the folloiwng problem.
Have an Access 2003 application that creates an Excel file containing
data from an Access parameter query. This is...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |