YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

NEED HELP! MACRO VB TRYING TO USE PI ADDIN ARCHIVE VALUE Options · View
khoadpham
#1 Posted : Thursday, June 23, 2011 1:25:19 PM
Rank: Newbie
Groups: Member

Joined: 6/23/2011
Posts: 2
Location: boston
HELLO!

In my excel spread sheet I have in column A PI Tags's, Column B Time Stamp, and I'm trying to write a macro that takes those PI Tag's and Time Stamp and get an Archive Value from it. Going down the columns until there are no more tags.

I tried putting

PIArcVal("bpu108:FIC-1149A/PID1/SP.CV",$C$6, 0,"CAMDVAPP01","auto")

Into a loop but that doesn't seem to work.

Any help would be greatly appreciated!

Thanks!
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
squatty
#2 Posted : Thursday, June 23, 2011 1:53:15 PM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
Look at the VBA code for the PIEXAM32.XLS file located in your pihome\excel directory. I don't want to copy and past the code here. Look at the bottom part of the code where it is reading data back from the PI Server. Also try and download the DAP (Data Access Pack) from the OSISoft website, in there they have a very nice PI-SDK help file with examples and very good explanations
khoadpham
#3 Posted : Thursday, June 23, 2011 2:15:37 PM
Rank: Newbie
Groups: Member

Joined: 6/23/2011
Posts: 2
Location: boston
ere a way i can just run PiArcValue in a macro?
squatty
#4 Posted : Wednesday, June 29, 2011 1:42:08 PM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
Here is a quick and dirty way of doing it. You can play around with this code in VBA and learn in the process, notice the double quotes.

Private Sub DO_SOMETHING()

Dim myform As String
myform = "=" & "PIArcVal(Sheet2!$A$1,Sheet2!$L$1,0,""mbkmis00"",""auto"")" 'A1 is tagnumber and L1 is timestamp

ThisWorkbook.Sheets("Sheet2").Cells(3, 12).Value = myform '3 is row and 12 is column

End Sub
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.