VBA Scripts on RSView SE

sephiroth

Member
Join Date
Jan 2009
Location
Sheffield
Posts
4
Hi everybody.

I'm having a problem rigth now with RSView, I need to execute periodic VBA Scripts on my application, the problem is that the VBA scripts can only be created independently for each display.

So how can I create a global script and execute it whenever I want?... for example calling it from an Event. I had seem that in RSView32 can be use a vbaExec function, it is possible to do the same in RSView SE... how????

J.J.
 
Hi everybody.

I'm having a problem rigth now with RSView, I need to execute periodic VBA Scripts on my application, the problem is that the VBA scripts can only be created independently for each display.

So how can I create a global script and execute it whenever I want?... for example calling it from an Event. I had seem that in RSView32 can be use a vbaExec function, it is possible to do the same in RSView SE... how????

J.J.

/sigh... ACH...

Okay. I'm going to try to describe this in the nutshell version, but it's a bit complicated anyway.

The best way of triggering a bit of code, is actually from the PLC. Use a bit, or analog value, or whatever. Step by Step follows, assuming you are triggering the function with a PLC bit called "Trigger".


  1. Create a dedicated window, it does not have to be pretty. Set it up as "On Top", "Cache After Displaying - YES", check off "Always Updating", "Show Last Acquired Value", and set the update rate to a relatively fast rate.
  2. Create a startup macro, to open that window with the /ZA switches. "Display _VBA_Code_Win /ZA". I also advise creating a button to close all windows, flush the cache, and then reopen "Home" windows with the above switch. The /ZA option will open the window, and keep it updating, even when it gets hidden by a 'Replace' window.
  3. On the new window, put an analog tag, pointing to the [PLC]Trigger bit, expose it to VBA, and use an OnChange event in VBA to trigger your other processing. Give it a name, such as "nd_TriggerDisp". NOTE: Generally, in the VBA for the window, you will first want to create a global tag array, and populate it with your trigger bit, so you can reset it:
In Global Declarations:

Dim GlobalGroup as TagGroup
Dim TagGlobal as Tag
Dim TagsInError as StringList

In DisplayLoad:
if GlobalGroup is Nothing Then
Set GlobalGroup = Application.CreateTagGroup(Me.AreaName, 500)
GlobalGroup.Add "{[PLC]Trigger}"

In your nd_TriggerDisp_Change() event for your tag on the window:

If nd_TriggerDisp.Value = 1 then
(Process your special VBA Code)

' Reset the tag in the PLC to indicate processing complete:
Set TagGlobal = GlobalGroup.Item({[PLC]Trigger])
TagGlobal.PendingWriteValue = 0
GlobalGroup.WritePendingValues(TagsInError)
End If
End Sub



That's it in a nutshell. Of course, you probably want to add other guarding in the VBA to ensure that this code doesn't get executed by every client. Use the computer name to determine which client should process the code.

Also, be sure to use full error checking in each routine, unlike the example above.

Good luck.
 
Thanks a lot for your reply.

I had the hope that i could find a less tricky solution for this, but I guess that it is not possible.

I'll try this.... thank you.
 

Similar Topics

Good Morning, This is my first post and my first real exposure to GE and the Fix/iFIX environments so please bear with me. I am currently in the...
Replies
7
Views
10,943
I need to use a TreeView in my FactoryTalk SE project and i found it under "ActiveX Object" > "Microsoft TreeView Control 6.0 (SP4)". Everything...
Replies
0
Views
20
I'm creating an HMI that has a recipe with 288 data point. It has 3 pieces of data for 96 segments. I need help with VBA code to copy all 288...
Replies
0
Views
136
Hi everyone Is it possible to change a button image in FactoryTalk View SE (v13.00) using VBA?
Replies
0
Views
75
Hi all. Currently I'm working on a VBa script for FTView. I would like to understand a bit better about some commands. 1) What are the...
Replies
3
Views
589
Back
Top Bottom