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

issues using the tagtot expression in VBA

$
0
0

My name is Aaron and I am new to using PI.

 

I am trying to write a program in the VBA environment of Processbook that will get a range of data during a month and sum the values and compare it to the same range of data for the previous year .  For example, I want to compare total Mega Watts for june 2014 to total Mega Watts for June of 2013.

 

I am trying to use the command TagTot('tag', 'starttime', 'endtime'. [, pctgood]). However I keep getting an error

 

This is  a snip of my code:

 

Private Sub CommandButton1_Click()

Dim month As Variant, day As Variant
Dim current_year As Variant
Dim previous_year As Variant, range As Variant
Dim current_525_tot As Variant

current_year = year(Date)
previous_year = current_year - 1
month = ComboBox2.Value
day = ComboBox3.Value
range = ComboBox1.Value

timestamp1 = "'" & day & "-" & month & "-" & current_year & "'"
timestamp2 = day & "-" & month & "-" & previous_year

 

current_525_tot=tagtot('EASE_EOH0252',timestamp1,'*')

 

ListBox1.AddItem (timestamp2 & "  " & timestamp1 & "  " & current_525_tot)
End Sub

 

I'm not sure if I am setting this up right  or if there is a library I need to use. any help is appreciated.

 


Viewing all articles
Browse latest Browse all 1120

Trending Articles



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