+ Reply to Thread
Results 1 to 3 of 3

Late Binding

  1. #1
    Registered User
    Join Date
    10-15-2009
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Late Binding

    I have developed a sampling application in Excel 2007 that uses a lot of VBA automation. When I developed the program I was unaware of the early/late binding issues and mistakenly did everything in early binding. Now I need to convert the code to late binding so that it can run on Office 2000 and 2003 platforms. I understand the concept of late binding and the need to declare objects; however I can't find any step-by-step explanation for actually re-coding the program. I am a self-taught programmer and everything I've found assumes a lot of knowledge.

    I would greatly appreciate answers to the following basic questions:

    1) How do I know which parts of my code are objects that needs to be put in the form:

    Dim Var1 as Object

    Set Var1 = createObject (.....)

    For example I have the following piece of code:

    Dim FrmCtrl as MSForms.Control -does this type of code need to be recoded?

    2) Does it make a difference if all of the late binding occurs within an excel application that is already open and running (i.e. I don't need to call up other Office applications or export the code somewhere)?

    3) Are all of the enumeration variables that will need to be replaced with constants identified with an "xl" preceding their name? As in "xldown". In other words, if I find and replace all of these variables with the appropriate constant will I have taken care of this issue?

    4) Should I be concerned about all of the userforms, command buttons and activeX controls that are being used in my application? Will these be able to work in Office 200 & 2003?

    5) Do I need to change the automation aspects such as: workbook_open, commandbutton1_click, worksheet_activate, etc...? I used these automations heavily in my coding and am now concerned that this may have impeded the compatibility of my program.



    Any other resources, books, blogs, forums, examples you can recommend would be VERY MUCH appreciated. I've just wasted a full work week surfing the web and trying to solve this issue on my own.



    Thank you,

    Katie

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    re: Late-binding

    For starters, you can add Option Explicit to the top of each code module, then remove most of references you added (VBA, Excel Object Library, and Forms should remain). Then the compiler will tell you what it doesn't recognize.

    Please take a few minutes to read the forum rules, particularly about code tags and thread titles.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Late Binding

    I think you are confusing yourself, and me.

    If you create a UserForm you don't need to bind the controls.

    Also, to create a workbook that will work across Excel versions you should work ith the earliest version, not the latest.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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