Solved

Binding - MS Access to MS Excel - What is it and does it matter

Posted on 2014-12-12
4
304 Views
Last Modified: 2014-12-13
I have read a few posts where people have indicated when within MS Access and creating an Excel instance that typically binding does not matter.  I am not quite sure what binding is relative to MS Access/Excel even after reading the posts.

However, one person indicated you should not do this:
Dim xlobj as Excel.Application
Dim objxlbook as workbook
Dim objxlsheet as worksheet
Set xlobj = CreateObject("Excel.Application)

You should do this
Dim xlobj as Object
Dim objxlbook as Object
Dim objxlsheet as Objects
Set xlobj = CreateObject("Excel.Application)

Whats the difference between the 2 sets of code ?
0
Comment
Question by:upobDaPlaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 150 total points
ID: 40497607
the first set is called early binding, which will require you to add the Excel library to your references

the second set is called Late binding that does not require the Excel library to the refernces

see this link Early and Late Binding (Visual Basic)
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 350 total points
ID: 40497609
There is early Binding and Late Binding.
With early binding, you go in the code editor to tools | references and set a reference to a library.
In this case, Microsoft Excel xx.0.
This provides you with Intellisense support and full F1 help support, which is very, very nice.
And if you are certain that your users have your version of Excel or higher, all will be well.
Early binding is very good in a personal, business and corporate environment where you have knowledge of the users' computer.

With Late binding, you do not set the reference.  You lose Intellisense and f1 support.  You must Dim all of the foreign items as Object and you may not use the application-specific constants -- you must discover and use their numeric equivalents instead.  So why would you do that?
Because you now no longer have a dependency on that specific library.  As long as the user has ANY version of Excel and you haven't used kitschy new features, your code will run.  This is very good if you are selling software to complete strangers.

Me, I use early binding and develop in Access 2003.  You, you need to decide what will work best for you.  Some folks will go through the development process using early binding, and then just before deployment, remove the references, fix the resulting compiling errors, and then ship the software.

Explanation enough?
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40497718
Good explanation Nick
0
 

Author Closing Comment

by:upobDaPlaya
ID: 40498072
Great.  It makes sense for me to go with early binding.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question