Consulting

Results 1 to 5 of 5

Thread: Solved: Help with getting a retun value from a method

  1. #1

    Solved: Help with getting a retun value from a method

    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!


  2. #2
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Couldn't you just use something like this?
    [vba]
    IsCDO = Application.RegisterXLL(Filename:="C:\WINDOWS\system32\cdosys.dll")
    If IsCDO Then
    MsgBox "CDO Installed"
    Else
    MsgBox "CDO Not Installed"
    End If

    [/vba]

  3. #3
    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.


  4. #4
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    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.
    Syntax
    expression.RegisterXLL(Filename)
    expression Required. An expression that returns an Application object.
    Filename Required String. Specifies the name of the XLL to be loaded.
    Remarks
    This method returns True if the code resource is successfully loaded; otherwise, the method returns False.

  5. #5
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Quote Originally Posted by jtrowbridge
    I tried that already and for some reason the variable (in your example IsCDO) always has a value of 0.
    Did you declared IsCDO as boolean ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •