Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-12-12
4
Medium Priority
?
306 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 600 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 1400 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

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.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

722 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