This is exactly what I want to do. Just stop the table from automatically adjusting the width upon refresh!
For anyone still waiting for Version 2504 (bug is still present in newest version, 2503, rolled out at my company), this is how I added the macro and added it to the Quick Access Toolbar:
- View --> Unhide Window --> PERSONAL.XLSB
(you want to save the macro in the PERSONAL.XLSB workbook so you can access from any workbook)
- View --> Macros --> View Macros
2a. in 'Macro Name', enter name you want to use (I did DontAdjustColumnWidth) --> Create
(VBA editor should open with a Module window in PERSONAL.XLSB)
2b. Enter italicized text below (see OKshef's post for full list)
2c. Save and close VBA editor
(You should be able to run the macro [make sure you're in a cell in your query table]; next step is optional)
- (To add the macro to a button in the Quick Access Toolbar) Customize Quick Access Toolbar --> More Commands... --> Choose commands from: --> Macros --> 'Add>>' to location of choice within QAT --> use 'Modify...' if desired to change display name and/or select symbol for button --> OK --> OK
Sub DontAdjustColumnWidth()
'
' For QueryTable, set properties NOT to adjust column width with Refresh
With Selection.ListObject.QueryTable
.AdjustColumnWidth = False
End With
End Sub