Fix Excel VBA Object Does Not Support This Property or Method
Question details
The user is encountering a VBA runtime error stating the object does not support the property or method when trying to refresh PivotTables via a UserForm macro.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Running a macro from a UserForm to refresh multiple PivotTables across the workbook.
- Observed behavior
- The macro throws an object property or method error (Run-time error 438) because an incorrect member or method is being called on the PivotTable object.
Before modifying your VBA code, open the VBA Editor and stop the macro execution if it is currently in debug mode. It is also highly recommended to save a backup of your workbook.
Update VBA Code to Use the RefreshTable Method
Resolve the error by replacing incorrect refresh commands with the supported `RefreshTable` method for PivotTable objects.
This runtime error occurs when you call a method or property that does not exist for the target object. In this scenario, attempting to use standard data refresh commands incorrectly on a PivotTable triggers the error. The correct method for PivotTables is RefreshTable.
Press `Alt + F11` on your keyboard to open the Visual Basic for Applications (VBA) Editor in Excel.
In the Project Explorer pane on the left, double-click the Module or UserForm that contains the problematic macro code.
Find the loop or specific line of code that attempts to refresh the PivotTable. Ensure the variable in use is properly defined as a `PivotTable` object.
Change the incorrect method call to `.RefreshTable`. For example, update your loop to: `For Each tblPivot In ActiveWorkbook.PivotTables`, followed by `tblPivot.RefreshTable`, and end with `Next tblPivot`.
Click the Save icon, close the VBA Editor, and trigger the macro from your UserForm again to verify the PivotTables refresh without returning an error.

Verify the Target Object Type Using TypeName
Check if the object your macro is interacting with is actually a PivotTable before calling the refresh method.
Try WPS Office for a Seamless Spreadsheet Experience
Looking for a reliable, lightweight alternative to Microsoft Excel? WPS Office provides excellent format compatibility and a familiar interface without the heavy subscription costs.

Frequently Asked Questions
What does Run-time error 438 mean in Excel VBA?
Run-time error 438 means 'Object doesn't support this property or method.' It happens when your VBA code tries to execute a command or read a property that the specific object (like a Range, Worksheet, or PivotTable) does not natively support.
How do I find the correct methods for a VBA object?
You can find correct methods by opening the VBA Editor and pressing F2 to access the Object Browser. Alternatively, you can rely on IntelliSense—the automatic dropdown menu that appears when you type a period after a properly declared object variable—to see a list of valid properties and methods.
Why does my code work in one UserForm but fail in another?
This often occurs due to scope issues or implicit references. If a UserForm refers to `ActiveSheet` instead of an explicitly named sheet, it might try to run the code on a worksheet where the target object doesn't exist or is of a different type. Always use explicit references, such as `Sheets("Data").PivotTables(1)`.




