Collect PI snapshot data as it is added to the system


App As Application

Passwords() As String

GoodOnly As Boolean

Servers() As String

Tags() As String


Users() As String

MaxEvents As Long


Return Value


SVB Example

' References required

' PixxAddin 1.0 Type Library (1.0)

' PISDK 1.3 Type Library (1.0)

' PISDKCommon 1.0 Type Library (1.0)


Option Base 1

Const g_nTags = 5

Sub Main

Dim PiConn As PixxUI

Set PiConn = AddIns.AddIn("PixxAddin.PixxUI.1")


Dim aServers(g_nTags) As String

Dim aUsers(g_nTags) As String

Dim aPwds(g_nTags) As String


Dim nItem As Integer

For nItem = 1 To g_nTags


aServers(nItem) = "PISERVER"

aUsers(nItem) = "piadmin"

aPwds(nItem) = ""


Next nItem


Dim aTags(g_nTags) As String


aTags(1) = "BA:ACTIVE.1"

aTags(2) = "BA:TEMP.1"

aTags(3) = "BA:CONC.1"

aTags(4) = "BA:LEVEL.1"

aTags(5) = "BA:PHASE.1"


Dim sErrMsg As String


On Error Resume Next


Dim b As Boolean

b = PiConn.PIConnection("PISERVER","piadmin","")

If Not(b) Then

MsgBox "Not Connected to the PI server"

Exit Sub

End If




If Err.Number <> 0 Then

MsgBox Err.Description

Exit Sub

End If


Wait 10


Dim s As Spreadsheet

Set s = PiConn.PIStopSnapshotData(Application)


If Err.Number <> 0 Then

MsgBox Err.Description

Exit Sub

End If


s.Visible = True


End Sub