将访问列名称导出到Excel [英] Export Access Column Names To Excel

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

问题描述

我有一个Access导出到Excel的语句,如下所示:

I have an Access export-to-Excel statement like this:

INSERT INTO [Excel 8.0;HDR=YES;IMEX=2;Database=D:\test2.xls].[Sheet1$] SELECT Description, Reals7, Reals8 FROM Components WHERE [Database Number] = 1



但是,只有在我预先创建test2.xls并将其设置为正确的列名(Description,Reals7,Reals8)时,它才有效.

使用查询,有什么方法可以实现:

1)获取要自动创建的XLS吗?
2)自动将定义的列名获取到工作表中? (或至少自动使用某些默认值,例如F1,F2等?)
3)别名列名? (未成年人)

干杯!



But it only works if I pre-create test2.xls and set it with the correct column names (Description, Reals7, Reals8).

Using the query, is there any way to:

1) Get the XLS to be created automatically?
2) Get the defined column names into the sheet automatically? (or at the least, to use some defaults like F1, F2, etc. automatically?)
3) Alias the column names? (minor)

Cheers!

推荐答案

SELECT 描述,Reals7,Reals8 FROM 组件位置 [数据库编号] = 1
SELECT Description, Reals7, Reals8 FROM Components WHERE [Database Number] = 1



但是,只有在我预先创建test2.xls并将其设置为正确的列名(Description,Reals7,Reals8)时,它才起作用.

使用查询,有什么方法可以实现:

1)获取要自动创建的XLS吗?
2)自动将定义的列名获取到工作表中? (或至少自动使用某些默认值,例如F1,F2等?)
3)别名列名? (未成年人)

干杯!



But it only works if I pre-create test2.xls and set it with the correct column names (Description, Reals7, Reals8).

Using the query, is there any way to:

1) Get the XLS to be created automatically?
2) Get the defined column names into the sheet automatically? (or at the least, to use some defaults like F1, F2, etc. automatically?)
3) Alias the column names? (minor)

Cheers!


我在工作中不得不从Access导出数据到Excel电子表格.我通常使用VBA从查询或表中导出.使用以下代码作为起点,如果您有任何疑问,请回复.祝你好运.

I have to export data from Access to Excel spreadsheets a lot here at work. I usually export from a query or table using VBA. Use the following code as a starting point and if you have any questions then reply back. Good luck.

DoCmd.OutputTo acOutputTable, "Table Name Goes Here", acFormatXLSX, SpreadsheetName, False


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

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