Quantcast
Channel: OSIsoft Users Community
Viewing all articles
Browse latest Browse all 1120

Excel VBA - Late Binding x Early Binding

$
0
0

Hello!

 

Here I am again, looking for help at the only place on internet where people really know about PI :)

 

I have a code (Excel VBA) that starts like this:

Dim srv As Server
Dim pt As PIPoint
Dim ptd2 As IPIData2
Dim val As NamedValues
Dim pv As PIValues
Dim dtI As New PITimeFormat
Dim dtF As New PITimeFormat

The problem is that when I run this Excel Workbook on a computar that doesn't have PI installed, it gives me an compilation error. Since it's not a runtime error, I am not able to handle this error.

 

What I think it could be a solution is to do late binding, so I would do something like this

Dim srv as Object
set srv = CreateObject("PISDK.Server")

So it will give me an runtime error and I will handle it and show an proper error message.

 

How can I do this? Which objects should I create for each one of my variables?

 

Thank you!


Viewing all articles
Browse latest Browse all 1120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>