I have this excel vba program I wrote years ago to make an easy way to pull a variable amount of PI data. I recently got a new computer using Windows 11, and now the program isn’t working. It’s failing on the tag search functionality. I get: “Compile error: User-defined type not defined” on the line: Dim search As New PISDKD1g.TagSearch
When I look in the object browser, I can see PISDKD1g and PISDK, so it seems to be fully defined, but for some reason, it is not being recognized.
full sub code:
Private Sub SearchButton_Click()
Dim search As New PISDKD1g.TagSearch
Dim Selected As PointList
Dim point As PIPoint
Dim p As Variant
Set Selected = search.Show
For Each p In Selected
Set point = p
If PItagsbox.Text = "" Then
PItagsbox.Text = point
Else: PItagsbox.Text = PItagsbox.Text & ", " & point
End If
Next
End Sub
Note: the data pull is in a different sub, but this is where the compile throws an error, and in the order of the program, I never even get to the data pull part because I can’t get past this. However, if I have a valid pi tag and enter that manually, it pulls data fine.
I had another program that I had to modify a bit to work in Windows 11 by putting “PtrSafe” in the function title, I tried that for this sub but that was not appreciated. I tried dimming these (“search, “Selected” and “point”) as “variant” and then setting to the type I wanted. I tried dimming these as objects and then using createobject to set them to the type I wanted. I tried just doing a simple TagSearch.Show
and that does not work. I’m really at my wits end on this so any direction is appreciated.
1