string == string?

javajom

Javajon
Local time
Today, 16:21
Joined
Mar 5, 2008
Messages
37
--------------------------------------------------------------------------------

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:
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.
 
should this
Code:
If Pass_Word = st Then
be
Code:
If Pass_Word = sh Then

If not where does st come from?

Brian
 
What a ????

Thanks, made that mistake learning java spent hours finding a method name error.
Thanks
 
Thanks, made that mistake learning java spent hours finding a method name error.
Thanks
If you put Option Explicit at the top of your class module, it will catch these types of errors. It will then insist you define a variable before you use it so it catches typo's.
 

Users who are viewing this thread

Back
Top Bottom