none
Reference to Microsoft Excel Library RRS feed

  • Question

  • I have created an Access database in Office 2010, which is being used in 2013 and 2016 versions.  I am about to move to a computer that has 2013 version.  If I make changes, those still using 2010 will have to set references to get into the database.  Is there a way to do this programmatically?  If I move to a newer version, it does it automatically, but moving to an older version requires setting references to the Excel library.

    GrandmaProgrammer

    Sunday, May 7, 2017 12:43 AM

Answers

  • Hi Grandma, Have you considered using Late Binding, so it won't matter which Office version the user has? To use Late Binding, you would declare your variables as generic objects and then use the CreateObject() method to automate Excel. For example, rather than using Dim varName As Excel.Application, you'll use Dim vatName As Object. And rather than Set varName = New Excel.Application, you'll use Set varName = CreateObject("Excel.Application") Hope it helps...
    Sunday, May 7, 2017 2:13 AM

All replies

  • Hi Grandma, Have you considered using Late Binding, so it won't matter which Office version the user has? To use Late Binding, you would declare your variables as generic objects and then use the CreateObject() method to automate Excel. For example, rather than using Dim varName As Excel.Application, you'll use Dim vatName As Object. And rather than Set varName = New Excel.Application, you'll use Set varName = CreateObject("Excel.Application") Hope it helps...
    Sunday, May 7, 2017 2:13 AM
  • I agree whole heatedly with theDBguy (as usual he is very knowledgeable!).  Late binding is the way to go when spring multiple versions of Access.

    See: https://www.devhut.net/2016/11/08/vba-early-binding-and-late-binding/ for a good primer on the subject.

    Also, I'm worried about you switching to 2013 while some of your users are still on 2010.  Your version could make a change to the database making unusable to them.  As a developer, you need to always do all the development using the oldest version that will be used to run your database, so in this case 2010.  Otherwise, you're asking for trouble.  Remember, Access is backwards compatible, but no software is forward compatible.  Think hard before proceeding with your upgrade.  This would be a great time to think about seeing up a development virtual machine with 2010.  You could upgrade while still having the ability to properly support your 2010 database.  Best of both worlds!


    Daniel Pineault, 2010-2016 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net


    Sunday, May 7, 2017 2:35 AM
  • Thank you for your input!  I program in my "spare time", so it might take a few days to test this, but it makes sense to me. 

    GrandmaProgrammer

    Monday, May 8, 2017 9:11 PM
  • Thank you for your comments on the danger of upgrading to 2013. I will look into getting the virtual machine. At the moment, I have access to a laptop with 2010, so I will use it until I deal with this issue.


    GrandmaProgrammer

    Monday, May 8, 2017 9:14 PM