1

我正在 Access vba 代码中创建一个 Excel 电子表格。我需要将列名从 A、B、C 等更改为有意义的名称。我曾高高在上,但找不到路。

4

3 回答 3

8

The column names in Excel cannot be changed. They are a fundamental part of how Excel operates.

When creating a spreadsheet based on a database table (sounds like what you are doing), the first row in the Excel spreadsheet will contain the field(column) names of your data. That way, when you need to read the data back into Access, or import the spreadsheet as a table; Access, by default, knows to look in the first row of the spreadsheet for the column names.

于 2009-07-24T16:18:02.163 回答
3

If my memory serves me correctly, I don't believe that you can change the Column header labels from the default A, B, C.

You could write the header names out in the first row of the spreadsheet

于 2009-07-24T16:18:49.290 回答
0

将 Excel 导入 Access 后,我使用以下方法更改列标题:

CurrentDb().TableDefs(TableName).Fields("OldName").Name = "NewName"

在这里找到的解决方案:https ://movefirstblog.wordpress.com/2008/10/08/access-vba-change-the-name-of-a-field-in-an-existing-table/

于 2019-01-30T11:40:56.123 回答