Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21843

Pass variable from one module to another (one sub to another sub)

$
0
0
I may not have all my terminology correct, but hopefully it will come across with what I am looking to do.

I have two MODULES in my VB Editor. I think we are using VB 6.3. Within each MODULE, I have multiple "SUB's". One of the subs is the following

Name:  BUTCH MACRO.jpg
Views: 122
Size:  286.7 KB

After I enter a value in the above mentioned input box, I want to be able to set certain variables in the next part of the code. These would be determined based on my CASE statement. In one part of this when I select CASE = 10, I want to be able to set the variable LOADLIST. I then want to transfer to another SUB routine called "VERIFY_TOSOH" and be able to use the variable LOADLIST in that SUB routine. I do not know how to do this....


Code:

Sub VERIFY_HEMATOLOGY_SECTION()
' Generated by the Reflection Macro Recorder on 08-16-2013 07:55:22.98.
' Generated by Reflection for UNIX and OpenVMS 14.0.6.
' BUTCH JONES 8/16/2013

    On Error GoTo ErrorHandler

    Const NEVER_TIME_OUT = 0

    Dim LF As String    ' Chr(rcLF) = Chr(10) = Control-J
    Dim CR As String    ' Chr(rcCR) = Chr(13) = Control-M
    Dim INSTRUMENT, PROFILE, INSTRUMENT1, LOADLIST As String
   
    LF = Chr(Reflection2.ControlCodes.rcLF)
    CR = Chr(Reflection2.ControlCodes.rcCR)

    With Session
       
        INSTRUMENT = InputBox("ENTER THE TEST OR ITEM YOU WISH TO VERIFY" & vbCrLf _
        & vbCrLf _
        & "1..  VERIFY XE-5000 with CBC/DIFF" & vbCrLf _
        & "2..  VERIFY XE-5000 CBC ONLY" & vbCrLf _
        & "3..  VERIFY XT-4000i with CBC/DIFF" & vbCrLf _
        & "4..  VERIFY XT-4000i with CBC ONLY" & vbCrLf _
        & "5..  VERIFY MANUAL DIFF (BIOVATION)" & vbCrLf _
        & "6..  VERIFY SED RATE" & vbCrLf _
        & "7..  VERIFY URINE EOSINOPHILS" & vbCrLf _
        & "8..  VERIFY BODY FLUIDS" & vbCrLf _
        & "=================================" & vbCrLf _
        & "9..  VERIFY TOSOH BY ACC #" & vbCrLf _
        & "10.  VERIFY TOSOH BY UID (XGLY)" & vbCrLf _
        & "11.  VERIFY " & vbCrLf _
        & "=================================" & vbCrLf _
        & "20.  " & vbCrLf _
        & "21.  " & vbCrLf _
        & " ", "VERIFY HEMATOLOGY SECTION ITEMS", 1)
       
        Select Case INSTRUMENT
            Case 1
                INSTRUMENT1 = "XE-5000"
                PROFILE = "CBC"
                Call VERIFY_CBC
                .STOPMACRO
            Case 2
                INSTRUMENT1 = "XE-5000"
                PROFILE = "NODIFF"
                Call VERIFY_NODIFF
                .STOPMACRO
            Case 3
                INSTRUMENT1 = "XE-4000i"
                PROFILE = "CBC"
                Call VERIFY_CBC
                .STOPMACRO
            Case 4
                INSTRUMENT1 = "XT-4000i"
                PROFILE = "NODIFF"
                Call VERIFY_NODIFF
                .STOPMACRO
            Case 5
                Call VERIFY_DIFFERENTIAL
                .STOPMACRO
            Case 9
                Call VERIFY_TOSOH_ACCESSION_NUMBER
                .STOPMACRO
            Case 10
                LOADLIST = "TOSOH8"
                Call VERIFY_TOSOH
                .STOPMACRO
            'Case 18
                'LOADWORKLISTNAME = "5600 BOTH"
                'PROFILE = "IMMUNOCHEMISTRY"
                'Call VERIFY_NO_CK
                '.STOPMACRO
            Case Else
                'NOTHING
                .STOPMACRO
        End Select
   
             
    End With
    Exit Sub

ErrorHandler:
    Session.MsgBox Err.Description, vbExclamation + vbOKOnly

    ' Recording stopped at 07:55:41.87.
End Sub



Code:

Sub VERIFY_TOSOH()
' Generated by the Reflection Macro Recorder on 02-09-2012 11:02:05.00.
' Generated by Reflection for UNIX and OpenVMS 14.0.6.
'
' USE THIS TO VERIFY TOSOH BY ACCESSION NUMBER.  REGULAR CHEMISTRY ACCESSION AREA.
'
    On Error GoTo ErrorHandler

    Const NEVER_TIME_OUT = 0

    Dim LF As String    ' Chr$(rcLF) = Chr$(10) = Control-J
    Dim CR As String    ' Chr$(rcCR) = Chr$(13) = Control-M
   
    LF = Chr(Reflection2.ControlCodes.rcLF)
    CR = Chr(Reflection2.ControlCodes.rcCR)

    With Session
       
            .Transmit "^EA" & CR

            .StatusBar = "Waiting for Prompt: Select LOAD/WORK LIST NAME:"
            .WaitForString LF & "Select LOAD/WORK LIST NAME:", NEVER_TIME_OUT, rcAllowKeystrokes
            .StatusBar = ""
            .Transmit LOADLIST & CR
           
            .StatusBar = "Waiting for Prompt: Select Performing Laboratory: CDD VAMC//"
            .WaitForString LF & "Select Performing Laboratory:CDD VAMC//", NEVER_TIME_OUT, rcAllowKeystrokes
            .StatusBar = ""
            .Transmit CR

            .StatusBar = "Waiting for Prompt: Work Load Area: TOSOH8//"
            .WaitForString LF & "Work Load Area: TOSOH8// ", NEVER_TIME_OUT, rcAllowKeystrokes
            .StatusBar = ""
            .Transmit CR

            .StatusBar = "Waiting for Prompt: Would you like to see the test list? No//"
            .WaitForString LF & "Would you like to see the test list? No// ", NEVER_TIME_OUT, rcAllowKeystrokes
            .StatusBar = ""
            .Transmit CR

            .StatusBar = "Waiting for Prompt: Do you wish to modify the test list? NO//"
            .WaitForString LF & "Do you wish to modify the test list? NO// ", NEVER_TIME_OUT, rcAllowKeystrokes
            .StatusBar = ""
            .Transmit CR

            .StatusBar = "Waiting for Prompt: Do you want to review the data before and after you edit? YES//"
            .WaitForString LF & "Do you want to review the data before and after you edit? YES// ", NEVER_TIME_OUT, rcAllowKeystrokes
            .StatusBar = ""
            .Transmit CR

            .StatusBar = "Waiting for Prompt: Verify by: 1//"
            .WaitForString "// ", NEVER_TIME_OUT, rcAllowKeystrokes
            .StatusBar = ""
            .Transmit CR

            .StatusBar = "Waiting for Prompt: Accession Date: TODAY//"
            .WaitForString LF & "Accession Date: TODAY//", NEVER_TIME_OUT, rcAllowKeystrokes
            .StatusBar = ""
            .Transmit CR
       
            'ENTER YOUR ACCESSION NUMBER AND BEGIN TO VERIFY HERE.
           
    End With
   
    Exit Sub

ErrorHandler:
    Session.MsgBox Err.Description, vbExclamation + vbOKOnly

    ' Recording stopped at 11:03:24.30.
End Sub



How do I pass the variable "LOADLIST" from the VERIFY_HEMATOLOGY_SECTION sub to the VERIFY_TOSOH sub?

Thanks
Attached Images
 

Viewing all articles
Browse latest Browse all 21843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>