Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Limiting input with input box


Hi I'm doing a school project and I'm trying to find a way to limit wha
the user enters into the input box...for example,

Sub Log_On()
Dim bText As String
' here is the INPUTBOX-function :
bText = InputBox("Please Type Your Name", "Username")
' here is the INPUTBOX-method :
bText = Application.InputBox("Please Enter Your Password"
"Password")
MsgBox "You typed the following password:" & Chr(13) & _
bText & Chr(13), , "Login Details"
Sheets("Hardware").Select
End Sub

Therefore, I want to limit the user to be only allowed to enter ''abc
into the password field.. How can I tweak my formula to allow me to d
that? Also, if teh user types in teh wrong password, I don't want th
macro to take him to the 'Hardware' sheet, I want it to stay in te
same sheet.

Thanks a lot.

--
petros8
-----------------------------------------------------------------------
petros89's Profile: http://www.excelforum.com/member.php...fo&userid=2464
View this thread: http://www.excelforum.com/showthread.php?threadid=49251

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Limiting input with input box

Usually when you're checking passwords, you want the user to type whatever they
want--but you want to verify it before your code does something for them.

Sub Log_On()

Dim UserNameText As String
dim PWDText as string
Dim RealPWD as string

RealPWD = "abc"

UserNameText = InputBox("Please Type Your Name", "Username")

PWDText = Application.InputBox("Please Enter Your Password", "Password")

MsgBox "You typed the following password:" & Chr(13) & _
PWDText & Chr(13), , "Login Details"

if pwdtext < realpwd then
msgbox "no, no, no!
else
Sheets("Hardware").Select
end if

End Sub

Be aware that this kind of stuff in excel is very simple to overcome by anyone
who is really interested.

petros89 wrote:

Hi I'm doing a school project and I'm trying to find a way to limit what
the user enters into the input box...for example,

Sub Log_On()
Dim bText As String
' here is the INPUTBOX-function :
bText = InputBox("Please Type Your Name", "Username")
' here is the INPUTBOX-method :
bText = Application.InputBox("Please Enter Your Password",
"Password")
MsgBox "You typed the following password:" & Chr(13) & _
bText & Chr(13), , "Login Details"
Sheets("Hardware").Select
End Sub

Therefore, I want to limit the user to be only allowed to enter ''abc"
into the password field.. How can I tweak my formula to allow me to do
that? Also, if teh user types in teh wrong password, I don't want the
macro to take him to the 'Hardware' sheet, I want it to stay in teh
same sheet.

Thanks a lot..

--
petros89
------------------------------------------------------------------------
petros89's Profile: http://www.excelforum.com/member.php...o&userid=24645
View this thread: http://www.excelforum.com/showthread...hreadid=492518


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limiting input by date NEHicks Excel Discussion (Misc queries) 1 February 1st 10 03:10 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
How do I add input data in the input ranges in drop down boxes. oil_driller Excel Discussion (Misc queries) 1 November 9th 05 10:31 PM
=SUMIF(Input!H2:H718,AZ19,Input!E2:E685)AND(IF ALex Excel Worksheet Functions 2 March 14th 05 09:19 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"