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

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
52
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
166
Hello Experts, I am trying to create a SINE Wave generator and i cannot seem to make it smoother. I have done this before but i forgot the exact...
Replies
6
Views
227
Is there a simple way (VBA or macro language) to acknowledge ONLY the most recent alarm? I upgraded recently all the way from RSVIEW 32 7.60 to...
Replies
4
Views
616
I don't think this has been discussed on here - so thought I'd share. TLDR: FTView v14 looks like it requires Logix Designer v36 on the same...
Replies
3
Views
611
Back
Top Bottom