Error message definition (1 Viewer)

gbanks

Registered User.
Local time
Today, 06:09
Joined
Feb 9, 2000
Messages
161
Below is part of module from a db I took over for someone who left are company. The db was running fine but for some reason now we receive an error when this is run. The error is Compile Error: User-Defined type not defined. It yellows out this line. Dim xlApp As Excel.Application
This line is used to open excel.
Is there something wrong with this code? I'm clueless. Thanks for the help...

Dim filetoopen As String
Dim varExcelName As String
varExcelName = saveme & ".XLS"
filetoopen = xlApp.GetSaveAsFilename(varExcelName, "Microsoft Excel Files (*.xl*), *.xls
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:09
Joined
Feb 28, 2001
Messages
27,222
The first thing that comes to mind is that this is a references problem. If this database is on a shared drive and you aren't using the same workstation that your predecessor used, then the odds favor that your references aren't set up correctly for that particular database. It is a registry issue as well as a database issue, so that's why different workstations get errors that the original develop's station wouldn't get.

So here's how you solve that.

Open the module window to that (or any other) code window. Wait for the toolbar and menubar to change to module context. (Should be less than a second unless you are on a slug-slow machine.)

OK, now follow menubar path Tools>>References to a messy looking dialog box that has a checkbox and some text on each line in the list window. Note that AC97 and AC2K differ in the location of this path. In AC2K, the path is available only on the menu bar of the separate code window. In AC97, it is on the main Access window's menu bar.

Scroll through that list. You are looking for entries that say MISSING in front of a text item. Again, odds favor that the line mentioning the Excel library will either be (1) unchecked or (2) MISSING. For AC2K, you probably want to find the "Microsoft Excel 9.0 Object Library." Probably the ... 8.0 library for AC97.

If you click on the module name, the area beneath the white list area shows you the expected file name for that module. So click the Browse option and find the module of that name - if you have it. (For a full Office installation, you should.) Once you find it, double-click it. It will become a reference for that database but will be in your local machine's registry file.

That should solve your problem.
 

gbanks

Registered User.
Local time
Today, 06:09
Joined
Feb 9, 2000
Messages
161
Thanks

Thanks Doc. That was the problem.
 

Users who are viewing this thread

Top Bottom