compile error


Posted by peter.m on June 23, 2001 4:22 AM

I have been trying to get the following Macro code
to work without any glory yet!
it is supposed to hide sheet 2,which it does,
then it is to ask user for a password,if wrong
MsgBox is to display"Call your Supervisor"
the part that will not work is the password and MsgBox

this is the code I have been using

Sub Hidesheet2macro()
'
' Hidesheet2macro Macro
' Macro recorded 06/21/2001 by Peter M.
'
' Keyboard Shortcut: Ctrl+Shift+H
If Sheets("sheet2").Visible = True Then
Sheets("sheet2").Select

ActiveWindow.SelectedSheets.Visible = False

End If
'Ask user for Password
Do

SrtPassword = InputBox("Enter,password")
'Enter SrtPassword="Youarein"
If ("Youarein") Then
Sheets("sheet2").Visible = True
Else
Temp = MsgBox("Call your Supervisor", 0)
End If
Loop Until SrtPassword = ("Youarein")



Posted by Ivan F Moala on June 23, 2001 4:51 AM

Try this instead.............your original was
trying to evaluate a string expression.


'
' Hidesheet2macro Macro
' Macro recorded 06/21/2001 by Peter M.
'
' Keyboard Shortcut: Ctrl+Shift+H
If Sheets("sheet2").Visible = True Then
Sheets("sheet2").Select
ActiveWindow.SelectedSheets.Visible = False
End If

'Ask user for Password
Do
SrtPassword = InputBox("Enter,password")
'Enter SrtPassword="Youarein"
If SrtPassword = "Youarein" Then
Sheets("sheet2").Visible = True
Else
Temp = MsgBox("Call your Supervisor", 0)
End If

Loop Until SrtPassword = "Youarein"

End Sub