473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Access export report with column formatting

Hello all,

I am trying to export an access report i had created with the exportwithformatting macro; the problem is the export happens but the excel file that it exports into does not seem to keep the column formatting from my query.

I framed a code but am still having issues: any suggestions on the below code is greatly appreciated.

Expand|Select|Wrap|Line Numbers
  1. Public Sub Workbook_receiveRCFormats()
  2.  
  3.   Dim acOutputReport As Object
  4.   Dim acTableRow As Object
  5.   Dim acOutputReport As String
  6.   Dim xlFileName As String
  7.  
  8.   Dim acFormat As acFormat
  9.  
  10.   Dim Index As Long
  11.  
  12.   Dim NoItems As Long
  13.   Dim I As Long
  14.  
  15.  
  16.   Set acContainer = ThisWorkbook.Container
  17.   Set acReport = acContainer.Reports("RC_FORMATS").Report
  18.   For Each acReportRow In acReport.Rows
  19.     Index = acReportRow("INDEX")
  20.     NoItems = acRCFormats.Count
  21.     If Index <= NoItems Then
  22.       Set acRCFormat = acRCFormats.Item(Index)
  23.     Else
  24.       For I = NoItems + 1 To Index
  25.         Set acRCFormat = New acRCFormat
  26.         acRCFormats.Add acRCFormat
  27.       Next I
  28.     End If
  29.     acRCFormat.setFormat acReportRow
  30.   Next acReportRow
  31.  
  32.     acOutReportData = "rpt-FINANCE"
  33.     xlFileName = "C:\Documents and Settings.xls"
  34.  
  35.     DoCmd.OutputTo acOutputReport, outReportData, acFormatXLS, xlFileName
  36.  
  37. End Sub
Thanks
Frank
Nov 27 '13 #1
1 2736
zmbd
5,501 Expert Mod 4TB
frank12345:

If I understand correctly, you want to keep the report's formating when it goes to excel, yes?

MS in the wisdom took that away... also for word. Only in the snapshop and pdf versions will keep your formating.

You might first attempt the transferspreadsheet method. This will require the use of a stored query; however, it can take parameters upon the call. There are several posts on site about this... basic information: DoCmd.TransferSpreadsheet Method (Office 2010)

The only other option is using automation. Please read thru the following link. It starts with Outlook; however, goes on to some basic Excel stuff.
Application Automation
It is a lot of work... each record has to be read out and then the column formatting can be set etc....

Read thru both and see which way you want to go.

It maybe that a combination of the two is the way to go.
Nov 27 '13 #2

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

Similar topics

1
by: Majstor | last post by:
Does anybody know how to export Report in Word, Excel or HTML with pictures (Access 2000)? I don't use snapshot format.
5
by: pelcovits | last post by:
How do I get Access to put a blank in a report column (but not eliminate the record completely), when the field in question is currency format, and the value is zero? My understanding is that null...
0
by: moshe_n | last post by:
Hello I try to export report from access 2000 by mail and always i get the massege " the report can not open the mail application" I use the Lotus notes application , noach,
0
by: Mariana | last post by:
Hello, I am exporting reports in pdf format from .net 2005 . The export is working fine; however the user values of stored procedure parameters does not show in the report. What do I need to do in...
4
by: riaane | last post by:
Please help: I have Conditional Formatting on a Report Field that fills the background Red if the criteria is met. This displays correctly in Report View, however, when I "OutputTo" this report to...
0
by: greylensman | last post by:
I know you can export an Access 2007 report to a Word .rft tab delimited file but that's not what I need. I'd like to get/put together the VBA (if possible) to export the Access Report directly to a...
0
by: nebula53 | last post by:
Hi, 1 - I created search criteria based in one input ( contract status “ Combo box”) I need to add to it another criteria (Vendor Number “ text Box” ) ( the number will be entered manually ) ...
2
by: ghiey | last post by:
hi to all, i have searched for a solution regarding exporting access 2007 reports to excel file. i have converted to access 2007 my database from access 2003. i guess microsoft omitted the ease...
5
by: jbrown8253 | last post by:
Microsoft Access 2007 Export Report for each record within a recordset I am attempting to click a button on a form that will export a report that is unique to each record. I created a query that...
3
by: rahul2310 | last post by:
I have created joining letter in access 2010,as it is a letter it is not in column and row format. When i export report to word it does not shows report instead it shows column headings and data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
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...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.