Vba code

craig1234

Member
Join Date
Oct 2015
Location
mi
Posts
1
Hi to all I am new to VBA I did some plain VBA a very long time ago but now I am trying to do it with FT SE an Rockwell makes it hard.

I am trying to get the user to input a number on the HMI to keep the project minimized for that length of time. When I first did the code I just kept the screen minimized for 30 seconds which sometimes we need longer so I tried this and it works but has one problem.

Now it does work but the problem is I enter the number the first time in the plc everything is good the bit are set correctly but it will not minimize. If I enter a number a second time then it will minimize then after the time entered it will maximize again. This happens all the time I have to do it twice to get it to work. I have stepped through the program and it worked great but when I run it as a project that is when I have the problem.

I would appreciate any help please like I said I am new to getting VBA stuff to work with Rockwell.

Thank-you
Craig

Here is my code.

Private Sub NumericInput1_Change()
On Error GoTo ErrorHandler
If Not IsError(NumericDisplay1.Value) Then
If NumericDisplay1.Value = 1 Then

Dim testString1 As String, localTags, testing
Set localTags = Application.CreateTagGroup(Me.AreaName)
localTags.Add "{[PAL2]ActiveScreen1[0]}"
localTags.Add "{[PAL2]ActiveScreen1[5]}"
localTags.Add "{[PAL2]ActiveScreen1[4]}"
testString2 = "" & localTags.Item(2).Value
testString1 = "" & localTags.Item(1).Value
testString3 = "" & localTags.Item(3).Value
On Error GoTo ErrorHandler
If Not IsError(NumericInput1.Value) Then
If testString3 = 1 Then
PauseTime = testString1
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Application.WindowState = gfxWindowStateMinimized
Loop
Finish = Timer
Application.WindowState = gfxWindowStateMaximized

End

End If
End If
Exit Sub
ErrorHandler:
LogDiagnosticsMessage Err.Description, ftDiagSeverityError

End If
End If

End Sub
 

Similar Topics

Hello Every one, I need a help on vba code for getting data from MSSQL server 2014 to display in FTview SE client version 12 . Thanks. Please...
Replies
4
Views
1,815
Hoping for some help on this one, we are running FTVIEW SE distributed on a server. The client file runs fine on this server. We have...
Replies
4
Views
3,759
Hello, it's been a little over a year now that I've been learning citect scada alone in version 7.2, I know how to make pages, synoptics, create...
Replies
4
Views
7,065
Hello guys, can anyone help me with FactoryTalk View Studio. I need to use a Global Object that contains VBA Macros in different displays, but it...
Replies
1
Views
1,677
I have VBA code on a FactorTalk View SE v11 project that reads various PLC tags in a FOR loop. All is good if the PLC tag exist. But for a...
Replies
4
Views
3,556
Back
Top Bottom