Results 1 to 6 of 6

Thread: [RESOLVED] multiple statements and conditions

  1. #1

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Resolved [RESOLVED] multiple statements and conditions

    Hello people,

    Could someone help me

    I need a code which loops through 3 different statements

    EN=lang1
    DE=lang2
    FR=lang3

    lang1=test1
    lang2=test2
    lang3=test3

    if myVar = EN then
    msgbox(lang1)
    else
    if myVar =DE then
    msgbox("lang2)
    else
    if myVar=FR then
    msgbox (lang3)
    if myVar="" then
    msgbox ("something else")

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: multiple statements and conditions

    unclear what you're after. please explain more fully.

  3. #3

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Re: multiple statements and conditions

    I got 4 different variables

    myVar= (can are EN or DE or FRA) depends on case to case.

    EN= run function 1
    DE= run function 2
    FRA= run function 3


    if myVar=EN run function 1
    if myVar=DE run function 2
    if myVar=FRA run function 3



    Thank you in advance

  4. #4
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: multiple statements and conditions

    Code:
    Select Case myVar
            Case "EN"
                Call sub1
            Case "DE"
                Call sub2
            Case "FRA"
                Call sub3
            Case Else
                MsgBox "Invalid country code"
        End Select

  5. #5

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Re: multiple statements and conditions

    its solved thank you sir!
    Last edited by elmnas; Aug 15th, 2014 at 09:05 AM.

  6. #6
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Re: [RESOLVED] multiple statements and conditions

    what are you expecting?

    The code was an example showing you how to do it, you still need to edit to fit your needs.

    For it to work you need to have a variable called MyVar that is set somewhere to one of you status's - (EN,DE or FRA) and you would need 3 subs called - sub1, sub2 & sub3.

    Heres what i mean

    Code:
    private Sub Run()
    
    'Run Test sub passing "EN" Will call sub1, change this to DE to run sub2!
    test "EN"
    
    End Sub
    
    Private Sub test(myVar as String) 
    
    Select Case myVar 
            Case "EN" 
                Call sub1 
            Case "DE" 
                Call sub2 
            Case "FRA" 
                Call sub3 
            Case Else 
                MsgBox "Invalid country code" 
        End Select 
         
    End Sub  
    
    Private Sub sub1()
    
    MsgBox "sub1"
    
    End Sub
    
    Private Sub sub2()
    
    MsgBox "sub2"
    
    End Sub
    Private Sub sub3()
    
    MsgBox "sub3"
    
    End Sub
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width