Working with late biding vba

talp101

New Member
Joined
Aug 31, 2013
Messages
6
hi,

i am working on a project that might be running on diffrent versions of Excel 2003/2007/2010

i heard of late biding and setting up all the Excel objects as Object type. but i haven't realized yet how should i work with this method. should i create a global object and will use it in every function, sub or sending an Object by ref to every function?

help me please.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
What objects, specifically?
 
Upvote 0
You mean like ...

Code:
    Dim xlApp       As Object
    Dim wks         As Object

    Set xlApp = CreateObject("Excel.Application")
    xlApp.Workbooks.Open "C:\myPath\myFile.xlsx"
    Set wks = xlApp.ActiveWorksheet
 
Upvote 0
Exactly, now what if I have several functions and subs how I am spouse to work with the Objects? Make them global are as an argument by ref for each function?
 
Upvote 0
Either way. IMO, public variables are overused, and make code less modular and more difficult to debug, but they have their place.
 
Upvote 0
Not knowing what you're trying to do, I can't recommend one or the other. Choosing whether to use Public, module-level, or local variables seems to me to be unrelated to late versus early binding.
 
Upvote 0
Why are you using late-binding?

Is this code going to be in an application other than Excel?
 
Upvote 0

Forum statistics

Threads
1,216,163
Messages
6,129,223
Members
449,495
Latest member
janzablox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top