AdjustColumnWidth 属性

       

如果每次刷新查询表时,列宽都会自动调整为最适合的状态,则该值为 True。如果每次刷新时列宽并不自动调整,则该值为 False。其默认值为 TrueBoolean 类型,可读写。

说明

列宽最大值为屏幕宽度的三分之二。

示例

本示例关闭对新增查询表(第一个工作簿中的第一张工作表上)的列宽自动调整。

With Workbooks(1).Worksheets(1).QueryTables _
    .Add(Connection:= varDBConnStr, _
        Destination:=Range("B1"), _
        Sql:="Select Price From CurrentStocks " & _
            "Where Symbol = 'MSFT'")
    .AdjustColumnWidth = False
    .Refresh
End With