+ Reply to Thread
Results 1 to 3 of 3

how to get the return value from excel builtin methods

  1. #1
    Registered User
    Join Date
    01-30-2013
    Location
    chennai, india
    MS-Off Ver
    Excel 2007
    Posts
    6

    how to get the return value from excel builtin methods

    hi,

    I am using the below code in my excel vba.

    Please Login or Register  to view this content.
    I want to check from the program whether the refresh worked correctly. i just want to know whether it pops up error because of invalid username and password. i saw in the link http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.odbcconnection.refresh.aspx .

    If the refresh method didnt completed correctly then the method 'refresh' returns false. how can i assign that return value to a boolean variable.

    i tried like

    Please Login or Register  to view this content.
    it throws the compile error as type mismatch.


    please help me how to check whether refresh method works correctly.
    Last edited by JBeaucaire; 01-30-2013 at 04:31 AM. Reason: Added code tags, as per forum rules. Don't forget!

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: how to get the return value from excel builtin methods

    I think the documentation about this instruction is not consistent and/or correct

    You could try creating a separate function with error handling

    Please Login or Register  to view this content.
    This function should return true in case of any errors, but without displaying warnings, unless ODBC generates one
    Last edited by OllieB; 01-30-2013 at 08:12 AM. Reason: added explicit ByRef keyword for parameter
    If you like my contribution click the star icon!

  3. #3
    Registered User
    Join Date
    01-30-2013
    Location
    chennai, india
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: how to get the return value from excel builtin methods

    thanks OllieB. your solution works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1