Do you mean something like:
Public last_result as Object (or variant?)
Private sub ttt()
if(something) then
last_result =
end if
end sub
Main Topics
Browse All TopicsHi x-perts,
I have some public vars wih specific types linked to a referenced library, ex
Public lastResult As RiskFitResult
This requires a specific DLL with RiskFitResult definition to be referenced.
Next, what happens, if that DLL is not available? The code returns a compile error, obviously.
How can I bypass these errors,if the DLL is not linked? I need to keep some reduced functionality of the code in case of missing (not available) DLLs
How can I do this
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
My recommendation would be:
1. Put all your public variables into one separate module. Any that you are concerned about references for, declare as Object.
2. Move all the @Risk code into its own module if possible. If you never call any code from that module if the reference is missing, you shouldn't have any problems. (If you can totally late bind, then you don't need the reference at all)
rory, i am stacked with a simple thing -how to identify the missing (non-existing reference). I am trying to avoid using VBProject and VBA extensibility library. So far I am playing with the following code.
Obviously, it generates a compile error, which cannot be bypassed by "On Error".
Is there a way of doing this check in run-time?
another problem as it seems that declaring potentially-missing public vars as Objects doesn't work as expected;
Original:
Global bestFitType As RiskFitStatistic
......
bestFitType = RiskKolmogorovSmirnovStati
==========================
New option with Object:
Global bestFitType As Object
......
Set bestFitType =RiskKolmogorovSmirnovStat
==========================
It returns "Type mismatch error"
any suggestions?
Thanks
No, the only way is to what I suggested before:
"Move all the @Risk code into its own module if possible. If you never call any code from that module if the reference is missing, you shouldn't have any problems. (If you can totally late bind, then you don't need the reference at all)"
If none of the code from that module is run, you won't get compiler errors. But again, you need to know if the reference is broken in order to know not to run the code. Perhaps you could use a file search for the add-in?
Business Accounts
Answer for Membership
by: roryaPosted on 2009-10-19 at 22:53:54ID: 25611310
You could simply declare it as an object and late bind?