Object Doesn’t Support This Property or Method Error: How to Resolve

Dealing with Objects/Class, Methods, Properties and events can be very confusing at times when you are still new in VBA programming or even programming in general.

If you are not careful during your coding, you might generate errors like Run-time error ‘438’ — “Object doesn’t support this property or method.” In this article, you are going to learn the reason for the occurrence of this error and the best way to fix it. But before diving into the topic of interest, it is important define some terms.

runtime error 438 object doesn't support this property or method
Figure 1: Picture of the error 438 Message Box


Understanding Objects, Methods, Properties and Events

What is an object in VBA?

An object represents an element of an application, such as a worksheet, a cell, a chart, a form, or a report. VBA is categorized as an Object-Oriented Programming (OOP) language, that is why in VBA coding, you must identify an object before you can apply one of the object’s methods or change the value of one of its properties.

A collection is an object that contains several objects of the same type (usually but not always). In Microsoft Excel, for example, the Workbooks object contains all the open Workbook objects. In VBA, the Forms collection contains all the Form objects in an application.

objects in a user form
Figure 2: Picture of objects on a User Form

What are Methods, Properties and Events?

Methods are actions that an object can perform. For example, Add is a method of the ListBox object, because it adds a new entry to a list box.

Properties are attributes of an object that defines one of the object’s characteristics, such as size, color, or screen location, or an aspect of its behavior, such as whether it is enabled/disabled, visible/hidden etc. To change the characteristics of an object, you change the values of its properties.

Each object has its own Methods and Properties. The diagram below gives some examples of methods, Properties and Events for the Form (UserForm) Object.

Events are actions recognized by an object, such as clicking the mouse or pressing a key, and for which you can write code to respond. Events can occur as a result of a user action or program code, or they can be triggered by the system.

visual view of an object
Figure 3: Examples of Methods, Properties, Events for the Form Object

The VBA Editor has an IntelliSense feature that displays the list of available properties and methods of an object when you type a period (.) after the object’s name.

intellisense features for an object
Figure 4: Screenshot of the IntelliSense feature of VBA

Reasons for the Run-time error 438: “Object doesn’t support this Property or Method”

This error occurs when you are trying to use a method/property that the specified object does not support (i.e. it is not found in the list of available methods or properties of the object).

For instance, if you have a Workbook object and try to access the Range property, it will give you the 438 error since the Range property belongs to the Sheets object. You probably have a typo for the method name. For example, the following code results in an error.

Sub Error438()
End Sub

The reason being that ActiveWorkbook returns a Workbook object. There is no Select method or property available for the Workbook object, therefore an error occurs.

How to Fix the Error

The way to fix this error is just to determine which methods and properties are available for an object. To achieve that, do any of the following:

the vba object browser
Figure 5: Screenshot of the Object Browser of the VBA Editor
  • Use the IntelliSense feature in the Visual Basic Editor. When you type a period (.) after a property or method in the Visual Basic Editor, a list of available properties and methods is displayed.
intellisense dropdown list
Figure 4: Screenshot of the Dropdown list form the IntelliSense feature of VBA

See also: User defined type not defined

Leave a Reply

Your email address will not be published. Required fields are marked *