如何在访问中创建宏 [英] How to create a macro in access

查看:99
本文介绍了如何在访问中创建宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个宏来获取查询结果并导出到格式化的Excel工作表?

How can I create a macro that will take the results from a query and export to a formatted excel sheet?

推荐答案

ewarts,


使用TransferSpreadsheet操作。您的TransferType将是导出;选择您的电子表格类型;放入您的查询名称(在表名行上);放入您希望保存电子表格的路径(包括文件名和.xls);说你是否想要字段名称;你可以将Range系列留空。


希望这会有所帮助,


Brad。
ewarts,

Use the TransferSpreadsheet action. Your TransferType will be Export; choose your Spreadsheet Type; put in your query name (on the Table Name line); put in the path of where you want the spreadsheet saved (including the name of the file and .xls); say whether or not you want field names; you can probably leave the Range line blank.

Hope this helps,

Brad.



到格式化的Excel工作表?
to a formatted excel sheet?



刚刚注意到格式化的你问题的一部分。用宏进行实验并且不喜欢结果。但是,使用VBA,可以获得一个查询,以便将其精确导出到现有的电子表格中。它会将新数据附加到电子表格中。


如果您需要有关代码的帮助,请告诉我们,


Brad。

Just noticed the "formatted" part of your question. Experimented with macros and was not liking the results. Using VBA though, was able to get a query to export fine into an existing spreadsheet. It will append the new data into the spreadsheet.

If you need help on the code, let me know,

Brad.


您是否必须先设置模板?通过获取查询结果导出到一个模板然后复制到格式化的工作表然后从第一个工作表移动到第二个工作表时,已经存在已导出到excel的宏。我可以发给你代码。
Did you have to setup a template first? there and already existing macro that export to excel by means of taking the queried result exporting it to one template then copying to the formatted sheet but it keeps aborting when moving from the first sheet to the second. I can send you the code.


这篇关于如何在访问中创建宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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