Vba scripting

Join Date
Oct 2014
Location
kochi
Posts
66
Hi all,
here is my babystep in VBA coding to display multipled result in a messagebox. Now i want to script the same result on a datalink(should be a continuous result instead of one time result i mean what i have done here is for each click) now i need to display a continuous result in a single click using data link.

if anyone knows the answer..please do reply..

Private Sub Rect1_Click()
Dim a As Integer
Dim b As Integer
Dim TEST As Long
a = Fix32.Fix.AI_0.A_CV
b = Fix32.Fix.AI1_2.A_CV
TEST = Fix32.Fix.AI_0.A_CV * Fix32.Fix.AI1_2.A_CV
MsgBox TEST
End Sub

Thank you
 
On the same form that your rectangle is on, add a timer - name it tmeUpdate and set the interval to your desired update rate, then double-click the timer and you should see code similar to this:

Private Sub tmrUpdate_Timer()
'Periodic update of Main machine state
txtData.text = fnUpdateData
End Sub

Also add a TextBox to your form (call it txtData)

Move your existing code into a function:
Private Function fnUpdateData() as Long
Dim a As Integer
Dim b As Integer
a = Fix32.Fix.AI_0.A_CV
b = Fix32.Fix.AI1_2.A_CV
fnUpdateData = Fix32.Fix.AI_0.A_CV * Fix32.Fix.AI1_2.A_CV
End Function
 
display a continuous result in a single click using data link.

what do you mean by that? is data link something specific, or a generic term for a ... data link?

where is this: "Fix32.Fix.AI_0.A_CV" coming from?

If all you want to do is display the answer to the equation in a textbox on a form, all the previous posts are correct, with the last one being more complete; but if that's all you have, the display will always be zero.

By the syntax of the Fix32.Fix.AI_0.A_CV it seems that this should be an input from something... what is it?
 
Last edited:
First of all thanks for your replies...
realolman you are right.. it is an input from a plc.. i need to display the multiplied result in iFix scada (datalink).Dtalink is a textbox like option in iFix.. in which i want to display result..
 
You started this thread by asking your question... I hope you won't mind me asking some questions of my own... I am somewhat knowledgeable in programming visual basic, and I have always been interested in using it for real world applications...

would you explain to me what hardware and software you are using? It sounds interesting and I never heard of what you posted. Could you post a link or something to explain it

thank you

PS. never mind.... I googled I Fix and got more info than I can understand... thanks anyway good luck to you in your project
 
Last edited:

Similar Topics

Hi guys, This may be veering off the 'automation/PLC' path a little...but has anyone had experience with interfacing excel with Historian Servers...
Replies
1
Views
2,581
Hi all, can anyone help me in scripting for 25% backward scrolling of a trend using a button..This is a critical project.. please help me..
Replies
21
Views
8,039
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
33
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
140
Hi everyone Is it possible to change a button image in FactoryTalk View SE (v13.00) using VBA?
Replies
0
Views
78
Back
Top Bottom