Jumat, 20 Mei 2016

[MS_AccessPros] Re: Get return value from Excel user function in Access

 

I forgat to mention that doing it that way requires that you add the Excel library to your references. You probably should not do it that way. Use late binding like this:



Public Function ExcelVersion() As String
    Dim objXL As Object         'Excel.Application
    Dim strVersNum As String
    
    Set objXL = CreateObject("Excel.Application")
    strVersNum = objXL.Version
    ExcelVersion = strVersNum
    Set objXL = Nothing
    
    
End Function


-Bill


---In MS_Access_Professionals@yahoogroups.com, <wrmosca@comcast.net> wrote :

Rod

Here is a very simplified snippet that returns the Excel version number.


Public Function ExcelVersion() As String
    Dim objXL As Excel.Application
    Dim strVersNum As String
    
    Set objXL = CreateObject("Excel.Application")
    strVersNum = objXL.Version
    ExcelVersion = strVersNum
    
    Set objXL = Nothing
    
    
End Function

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.microsoft.com/en-us/PublicProfile/35852?fullName=Bill%20%20Mosca
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com



---In MS_Access_Professionals@yahoogroups.com, <desertscroller@cox.net> wrote :

My application links a spreadsheet from Excel to Access (both 2010).  To get the data ready several user defined functions were created in Excel.  The issue is I would like to ensure that the user is using the current version of the add-in.  My idea is to create a Excel function to identify the current version.  Access would run the function and retrieve the version number and compare it to the latest released version.  I realize I will need to activate Excel with the add-in loaded to accomplish the data request.  Just not sure how to get the return value.

Any suggestions would be greatly appreciated.
Rod



 

__._,_.___

Posted by: wrmosca@comcast.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

Upgrade your account with the latest Yahoo Mail app
Get organized with the fast and easy-to-use Yahoo Mail app. Upgrade today!


.

__,_._,___

Tidak ada komentar:

Poskan Komentar