将访问报告导出到Excel保持格式 [英] Export Access Report to Excel Keeping Formatting

查看:77
本文介绍了将访问报告导出到Excel保持格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从Access导出报告并保留所有格式。


即行,盒等...


或者您是否需要创建一个Excel模板,然后使用宏或一些VB代码运行访问查询以生成具有预定义格式的Excel工作表?


谢谢提前。

Is it possible to export a report from Access to Excel and keep all the formmating.

i.e. Lines, boxes etc...

Or do you need to create an excel template and then use a macro or some VB code to run an access query to generate the excel sheet with the pre-defined formatting?

Thanks in advance.

推荐答案

导出到Excel或Word时,不能保持报表格式:-(


我只是使用报告的查询和DoCmd.TransferSpreadsheet命令来获取数据。当需要格式化时,您可以使用Excel中的宏来执行此操作,或者从VBA代码管理所有内容(被称为自动化)


对不起消息抱歉....


Nic; o)
You can''t keep the formatting from a report when exporting to Excel or Word :-(

I just use the report''s query and the "DoCmd.TransferSpreadsheet" command to get data exported. When formating is needed, you can do this with Macro''s in Excel, or manage every thing from VBA code (called "automation")

Sorry for the bad news....

Nic;o)

您可以使用DoCmd.TransferSpreadsheet基于代码中的查询导出,而不是在数据库中构建的查询吗?我在字符串中有一个select查询,我将它放在一个记录集中,我想使用DoCmd.TransferSpreadsheet将该记录集导出为Excel文件,并且我已经尝试将记录集作为表名放在表达式中: br />
Can you use DoCmd.TransferSpreadsheet to export based off of a query in code, rather than a query built in the database? I have a select query in a string, I put it in a recordset, and I want to export that recordset as an Excel file using DoCmd.TransferSpreadsheet, and I''ve tried putting the recordset as the table name in the expression:

展开 | 选择 | Wrap | 行号


DoCmd.TransferSpreadsheet命令需要已保存。查询运行。


然而,您可以使用SQL文本动态填充查询,如:
The DoCmd.TransferSpreadsheet command requires a "saved" query to run.

You can however fill a query dynamically with the SQL text like:
展开 | 选择 | 换行 | 行号


这篇关于将访问报告导出到Excel保持格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆