FactoryTalk View SE with VBA code

gcurtis

Member
Join Date
May 2012
Location
NJ
Posts
4
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
 
If not the ability to tell me what is missing, does anyone have an example of VBA code in a FactoryTalk display?
 
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.
 
How would a display replace a form in this case? Do you have any sample code that you could show?

Thanks.
 
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

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
135
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...
Replies
2
Views
2,281
Hello group, I have been migrating a project from RSView 32 V7.6 to FactoryTalk View SE Local Station V12 over the last couple of days. All told...
Replies
0
Views
997
For trend charts, I can use an ActiveX Calendar control to select a date on a trend using the following code where "Trend" is the name of the...
Replies
2
Views
1,575
Anyone know how to change the mouse icon to something else using VBA? It looks like it can be done with VBA forms and based on the object the...
Replies
0
Views
2,208
Back
Top Bottom