View Full Version : Solved: Help with getting a retun value from a method

10-10-2007, 09:43 AM
I'm loading a library that enables me to send emails through the macros that I'm running. I use this email function mainly for error trapping.

I know that the Application.RegisterXLL method will retun a True if the library was loaded properly and a False if the library was not loaded. I need to know how to get the Application.RegisterXLL method to return this value so I can store it in a variable.

Here's the line I'm using to load the library:

Application.RegisterXLL Filename:="C:\WINDOWS\system32\cdosys.dll"

Any help would be awesome!


10-10-2007, 09:55 AM
Couldn't you just use something like this?

IsCDO = Application.RegisterXLL(Filename:="C:\WINDOWS\system32\cdosys.dll")
If IsCDO Then
MsgBox "CDO Installed"
MsgBox "CDO Not Installed"
End If

10-10-2007, 02:29 PM
I tried that already and for some reason the variable (in your example IsCDO) always has a value of 0.

I've checked the references and this library is definately getting installed after Application.RegisterXLL is executed. So I know this is working.

Isnt there a property that will have the return function assigned to it? If anyone knows or knows of a resource (like a object/property map or dictionary) I would be grateful.

: pray2:

10-10-2007, 04:25 PM
This is straight from the Help files.

RegisterXLL Method

Loads an XLL code resource and automatically registers the functions and commands contained in the resource.
expression Required. An expression that returns an Application object.
Filename Required String. Specifies the name of the XLL to be loaded.
This method returns True if the code resource is successfully loaded; otherwise, the method returns False.

10-19-2007, 12:58 AM
I tried that already and for some reason the variable (in your example IsCDO) always has a value of 0.
: pray2:Did you declared IsCDO as boolean ?