FTView SE reusing code from another display

ppb1487

Member
Join Date
Jul 2015
Location
Ah
Posts
15
I am a newbie to VB Scripting but looking around threads I found a code to help me out reusing a Sub I have already written in another display. To save me cope and pasting the whole Sub over and over again.

Here is what I have so far:

I have a display that I am referring to and have set its properties to "Keep at back" and "Always Updating"
Also have a macro saying "Display MAIN_MENU /B /ZA" which is what I startup along with the display. (MAIN_MENU is the name of the display)

Now I have a Public Sub "FileCheck" in that display and would like to call that sub from another display

In the second display I have the following code:
Dim AllDisplays As Displays
Dim MyKernelDisplay As Display

Private Sub Display_AnimationStart()
Set AllDisplays = LoadedDisplays
Set MyKernelDisplay = AllDisplays.Item("MAIN_MENU")
End Sub

Private Sub Button3_Released()
Call MyKernelDisplay.FileCheck
End Sub

Problem: When I hit the button, it does not call the function but highlights the Call function and says "Runtime Error 424 - Object Required"

Been banging my head about this for like a few hours 🔨 but have nothing so far
Need your help to see what the issue might be or am I missing out on something here
 
Found a problem

Well I found one problem, but dont know the solution to it
The error I get is not because it cannot refer the Sub to the other display. It does refer to it when inside the Sub all I have is a MsgBox, but it throws this error when I have anything else coded in it.

Anything you see here I dont??
Thanks in advance
 
You are beating your head against the frustrations of FTView's VBA model.

More details, exactly WHAT code is in each display, and show exactly the call chain you are using.

While it is possible to refer to code in other displays, you might be seeing a problem with "FileCheck" not being defined in the calling display, so it doesn't know exactly how to call it.

Across displays, I generally try to only refer to and interact with ActiveX objects that are exposed by reference to the code. This helps to clear up calling problems with references.
 
Thanks rdrast for the reply
I didnt quite understand the last line

In regards to the call for FileCheck, its exactly as written in Buton3 above, I've copied and pasted it here.

With whats inside it,
Public Sub FileCheck()
CurrentDate = DateTime.Date
FileName = "D:\Data\DataLog_" & Day(CurrentDate).xls
MsgBox (FileName)
End Sub

PS: Please disregard the previous comment of it working when there was only a MsgBox inside it. It worked a couple of times and now has stopped working even with just the msgbox
 

Similar Topics

I am creating a global object in FTView SE 13. I want to have a string read from the PLC and display (in this case the tagname). So lets say...
Replies
4
Views
171
I want to set user security level based on the value of a tag in my PLC called "ActiveUser". That tag will contain the A-P code which we use for...
Replies
6
Views
218
Hi All, we've recently upgraded from FTView SE v10 to v12. Since the upgrade we've been having a problem where the HMI is slow to update tags in...
Replies
0
Views
90
Hi, I have an issue accessing tags in 3 of my plcs'. When I go to select a tag there is no folder drop down as can be seen in the photo. Any...
Replies
0
Views
90
Hello, I have converted RSView 32 to FTView SE 14 (I have tested FTView 12 before as well and there were some difficulties so I moved on to...
Replies
4
Views
255
Back
Top Bottom