You can find the Excel tips you're looking at Pro-business Excel VBA Programming by entering the keyword in the textbox below and clicking the "Google Search" button.

Monday, August 6, 2007

Referencing Objects

Situation:
When you receive an error message about a missing object, sometimes the culprit is not the VBA program itself. Most of the time, this kind of situation is due to improper referencing of the MS Excel to required object file. To correct this problem, there are two things that you can do:

Solutions:
1.) The required object is already loaded in the OS memory but Excel referencing is not established. To do that, you have to run the VBAProjects References by clicking Tools>References on the VBA Editor, as shown below:














Once clicked, the Reference Window will appear (please see below) and you will see choices of objects that you can check to be used in your application development. Some of the objects are already checked. Please do not uncheck any of those because it might bring about an unwanted behavior on MS Excel and can corrupt your file.



















Let’s go back to the original situation. To get rid of the missing object error, you have to check the object that your program is looking for from the list of objects references. If the object is not in the list do number 2 below.

2.) In this approach, an object file is needed to be uploaded in the OS memory and must be recorded to the Windows registry. First thing to do is locate the path of the object file and register it by using the “regsvr32” program. The “regsvr32” program is already included in the Windows installation. To register, click Start>Run and enter the following:

Regsvr32 [path][object file]

When object file is registered successfully, do the steps in number 1.








Click here to subscribe and receive Pro-business Excel VBA Programming tips.


If you like this post in Pro-business Excel VBA Programming, buy me a coffee.


0 comments: