+ Reply to Thread
Results 1 to 3 of 3

String=String

  1. #1
    Registered User
    Join Date
    03-02-2008
    Posts
    8

    String=String

    Hi,
    Just a quicky, How do I compare 2 strings? I've just started in VBA and not quite use to the syntax. Here's the code I've done so far and works up to the point where it compares strings.

    PHP Code: 
    Public Function fShowMsg()
    Dim Pass_Word As String
    Dim sh 
    As String
    Pass_Word 
    "jon"
    fShowMsg MsgBox("Do you know the code?"vbYesNo)
    If 
    fShowMsg vbYes Then
    sh 
    InputBox("Enter the Password")
    If 
    Pass_Word st Then
    MsgBox 
    ("Hello.")
    End If
    MsgBox ("Sorry that was incorrect, please contact creator.")
    End If
    End Function 
    It's only a rough function at the moment, so probably lots of errors.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    What you did was fine, except for the typo:
    Please Login or Register  to view this content.
    If you put Option Explicit at the top of all your modules, it will require you to declare all variables, which is good practice and would have caught this error at compile time.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645
    Why are you using Function?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1