Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Late Binding

I have a project which links to either of two other packages.
Depending on which package is being used the alternative package will
not be installed and/or will not be selected in the VBA "References"
list.

I have created wrapper classes to selectively act on objects of
classes from each of the other applications but I am still having
problems with "User defined type not defined"

The problem arises any time I try to Dim a variable as a type defined
by one of the external applications even if the code will never run
through that area (Of course the compiler/parser has no way of knowing
that)

Is there any way to have conditional Dim-ing? Should I instead be
declaring as objects and then creating using CreateObject rather than
"Dim O as New clsRandomObjectWhichMightNotExist"

Any pointers or guidelines?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Late Binding

If you may or may not be able to use Early Binding why not be done with it
and use Late Binding. Change related object declarations to "As Object' and
use CreateObject.

For developing, set the references and revert to Early Binding methods to
get the intellisense, and re-adapt to Late Binding when done.

Regards,
Peter T


"atpgroups" wrote in message
...
I have a project which links to either of two other packages.
Depending on which package is being used the alternative package will
not be installed and/or will not be selected in the VBA "References"
list.

I have created wrapper classes to selectively act on objects of
classes from each of the other applications but I am still having
problems with "User defined type not defined"

The problem arises any time I try to Dim a variable as a type defined
by one of the external applications even if the code will never run
through that area (Of course the compiler/parser has no way of knowing
that)

Is there any way to have conditional Dim-ing? Should I instead be
declaring as objects and then creating using CreateObject rather than
"Dim O as New clsRandomObjectWhichMightNotExist"

Any pointers or guidelines?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Late Binding

On 2 Jun, 16:38, "Peter T" <peter_t@discussions wrote:
Change related object declarations to "As Object' and
use CreateObject.


I have since found that that isn't as painful as I feared, and I am
part way through doing it (This is a _big_ excel macro),
I found that the declaration CLSIDs are all listed together in Regedit
(unless there is an easier way?) and it is only the dim O as new lines
that need changing.
The vast array of enumerated types are proving annoying, but no worse
than that.

Thanks for the confirmation that I am on the right track.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Late Binding examples of binding excel application HeatherO Excel Programming 13 March 17th 05 08:19 AM
Late Binding Todd Huttenstine[_3_] Excel Programming 3 April 30th 04 11:01 AM
Late Binding Cindy Excel Programming 11 April 23rd 04 03:34 PM
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM
DAO Late Binding? Sharqua Excel Programming 2 January 4th 04 02:05 AM


All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"