FactoryTalk View SE with VBA code

Hi all,

First time poster.

I am having some issues getting some VBA code to copy over to FactoryTalk in hopes of displaying a screen for a vision system on the HMI. I have the code that works fine in Visual Studio, but I am not sure what steps need to be taken to get it to initialize the connection and launch on my HMI using FactoryTalk. I will paste my current code at the bottom, and any insight on what steps need to be followed for this to work in FactoryTalk is much apprecitated.

Thanks in advance.

PublicClass Form1
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
EndSub
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Dim state AsLong


state = VWXG.Initialize()
VWXG.Address = "192.168.0.10"
VWXG.Port = 8502
state = VWXG.Connect()
state = VWXG.StartRemoteDesktop(0)


EndSub
End
Class
 
OK. A couple of general questions. I wouldn't call myself a VB/VBA expert, but I've done a lot of VBA programming in SE. But there is still much more to learn.

What Visual Studio are you using. VBA in SE most closely resembles VB6, NOT VB.NET. Also I don't think you can use forms in SE. I'm not sure at the moment that you can't but the way SE works, even if you could use forms, I wouldn't. the container for VBA code in SE are the displays.
 
OK. Let's go back to the beginning. This vision system, what do you wnat to dispaly in SE? Just the data from it, or the actual pictures? Do they provide some sort of OCX to do this?
 
OK. A couple of general questions. I wouldn't call myself a VB/VBA expert, but I've done a lot of VBA programming in SE. But there is still much more to learn.

What Visual Studio are you using. VBA in SE most closely resembles VB6, NOT VB.NET. Also I don't think you can use forms in SE. I'm not sure at the moment that you can't but the way SE works, even if you could use forms, I wouldn't. the container for VBA code in SE are the displays.

You can use forms in SE, although I strongly suggest that you do not if at all possible, as SE handles memory extremely poorly by itself, and many times worse with VBA forms. That said, forms do work, and even support ActiveX containers, I generally use them for the display of reports from CrystalReports.

And correct, VBA != VB.net They are completely different.
 
Thank you for the responses. Once you mentioned not using forms, it all became much easier for me to figure out. Just so you guys can see, this was the code that ended up working. The VB6 was the way to go as well.

Private Sub Display_Load()
Dim state As Long
state = VWXG.Initialize()
VWXG.Address = "150.150.150.5"
VWXG.Port = 8502
state = VWXG.Connect()
state = VWXG.StartRemoteDesktop(0)
End Sub
 

Similar Topics

Hello. I wonder if anyone knows how to run a vba function in FactoryTalk view studio SE when recipe is saved? I looking for the solution but can't...
5
Replies
912
Views
I need to do a synchronous read (immediate read, not cached read) of a PLC array tag in VBA. The only way I have found is to read all the elements...
27
Replies
2,084
Views
I am looking for an VBA example to Display a Popup that has placeholders (#1) - (#22) and pass parameters from the HMI Tag Database to the...
1
Replies
1,449
Views
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...
0
Replies
912
Views
Hi, Can someone guide me through how to use FactoryTalk SE VB script to open communication with SQL Server? which command I can use? Are there...
2
Replies
5,220
Views
Top