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

Calling the "Tag Search" window in Excel using VBA Options · View
matthiasdg
#1 Posted : Tuesday, October 20, 2009 10:39:09 AM
Rank: Newbie
Groups: Member

Joined: 10/20/2009
Posts: 1
Location: Budapest
Hello,

I am looking for a way to call the "Tag Search" window using VBA.

I want people using my program to have a way to put a certain tag of their choice in the list of tags that need calculating.

So I have the following options:
1) they need to search it first using PI or the Excel Tag Search and copy the number then use the form I use in my program to indicate what calculations have to be done and where they have to be mailed to/ stored.

2) the more userfriendly way which I would prefer to use:
They can use the "browse" button on the form they called up and that one fills in the correct tagname for them after they selected it from the Tag Search window.

I tried recording the call with a "record macro" but unfortunately the "tag search" leaves the recording blank, which is why I ask here what the correct syntax is.

Thank you,
Matthias
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.
RJK Solutions
#2 Posted : Tuesday, October 20, 2009 1:02:10 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Matthias,

Welcome to the forum.

You need to add 2 references to your VBA project:

- PISDK Type Library
- PISDK Dialogs

Then you can call the Tag Search and retrieve a PISDK.PointList object.

For example:

Code:

Private PList as PISDK.PointList

Private Sub CallTagSearch()

Set PList = PISDKDlg.TagSearch.Show()

Debug.Print "Number of tags selected = " & PList.Count

End Sub


The PointList object is a collection of PIPoint objects.

Enjoy!

Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
vretor
#3 Posted : Wednesday, October 06, 2010 12:31:12 PM
Rank: Newbie
Groups: Member

Joined: 10/6/2010
Posts: 1
Location: Norway
Hi,

I`m doing almost the same, but i want to have dthe selected tag put in to my cell in my worksheet.

Normaly i can select a cell, then open tag search and dobble click on the tag i want, and it is returned to the cell.

But when i use Set PList = PISDKDlg.TagSearch.Show(), it just dissepears when i dobble clik on a tag.

Is there a quick fix to this ?

Torgeir
RJK Solutions
#4 Posted : Wednesday, October 06, 2010 2:14:48 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Torgeir,

That is because when you double click on a tag the focus returns to your code, where you need to process the selected tag.

Code:

Set PList = PISDKDlg.TagSearch.Show()
If PList.Count > 0 Then
   Me.Application.Selection.Value = PList(1).Name
End If
Principal Consultant
Real-Time Data Management @ Wipro Technologies
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.