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

I'm using an inputbox to get a PIN number from the user to allow access. I
want to be able to mask the input similar to password input where asterisks
appear when typing. How would I go about doing this?
--
Bernie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Hidi keyed input with asterisk

easiest way would be to create your own custom userform.
However, if you want to continue using inpubox method then have a look at
this site. There is a sample workbook you can download

http://www.xcelfiles.com/API_09.html
--
jb


"Bernie Richard" wrote:

I'm using an inputbox to get a PIN number from the user to allow access. I
want to be able to mask the input similar to password input where asterisks
appear when typing. How would I go about doing this?
--
Bernie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Hidi keyed input with asterisk

Hi,

You can also use this. The last sub
Sub GetPassWord()
is where you get your input with a maked input box.

Mike

Option Explicit
''/////////////////////////////////////////////////////////////////
''// 25 May 2003 //
''// Amended Ivan F Moala
''// Call with myresponse=InPutBoxPwd(etc
''// from any module
''/////////////////////////////////////////////////////////////////

Public Declare Function GetActiveWindow _
Lib "user32" () _
As Long

Public Declare Function FindWindowEx _
Lib "user32" _
Alias "FindWindowExA" ( _
ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) _
As Long

Public Declare Function SendMessage _
Lib "user32" _
Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) _
As Long

Public Declare Function SetTimer _
Lib "user32" ( _
ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) _
As Long

Public Declare Function KillTimer _
Lib "user32" ( _
ByVal hwnd As Long, _
ByVal nIDEvent As Long) _
As Long

Public Declare Function GetForegroundWindow _
Lib "user32" () _
As Long


Private Const nIDE As Long = &H100
Private Const EM_SETPASSWORDCHAR = &HCC

Private hdlEditBox As Long
Private Fgrndhdl As Long

Public Function TimerFunc( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal nEvent As Long, _
ByVal nSecs As Long) As Long

Dim hdlwndAct As Long

'// Do we have a handle to the EditBox
If hdlEditBox 0 Then Exit Function

'// Get the handle to the ActiveWindow
hdlwndAct = GetActiveWindow()

'// Get the Editbox handle
hdlEditBox = FindWindowEx(hdlwndAct, 0, "Edit", "")

'// Set the password character for the InputBox
SendMessage hdlEditBox, EM_SETPASSWORDCHAR, Asc("*"), ByVal 0

End Function

Public Function InPutBoxPwd(fPrompt As String, _
Optional fTitle As String, _
Optional fDefault As String, _
Optional fXpos As Long, _
Optional fYpos As Long, _
Optional fHelpfile As String, _
Optional fContext As Long) As String

Dim sInput As String

'// Initialize
hdlEditBox = 0
Fgrndhdl = GetForegroundWindow
'// Windows-Timer
SetTimer Fgrndhdl, nIDE, 100, AddressOf TimerFunc

'// Main InputBox
If fXpos Then
sInput = InputBox(fPrompt, fTitle, fDefault, fXpos, fYpos,
fHelpfile, fContext)
Else
sInput = InputBox(fPrompt, fTitle, fDefault, , , fHelpfile, fContext)
End If

'// Kill the correct Timer
KillTimer Fgrndhdl, nIDE
'// Pass result
InPutBoxPwd = sInput

End Function

'////////////////////////////////////////////////////
'// This is The main routine
'// where we test it
'////////////////////////////////////////////////////

Sub GetPassWord()
Dim X As String

X = InPutBoxPwd("Please enter password", "Sentry")
If X = vbNullString Then
MsgBox "User Cancelled"
Else
MsgBox "User entered " & X
End If

End Sub


"Bernie Richard" wrote:

I'm using an inputbox to get a PIN number from the user to allow access. I
want to be able to mask the input similar to password input where asterisks
appear when typing. How would I go about doing this?
--
Bernie

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Hidi keyed input with asterisk

Thank you both , Just what I needed!
--
Bernie


"Bernie Richard" wrote:

I'm using an inputbox to get a PIN number from the user to allow access. I
want to be able to mask the input similar to password input where asterisks
appear when typing. How would I go about doing this?
--
Bernie

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
Formula to Determine if Cell Value is from a Keyed Value or a Form JG Excel Discussion (Misc queries) 2 March 12th 10 04:21 PM
How do you hide the value of a cell until data is keyed into anoth akemeny Excel Discussion (Misc queries) 11 June 18th 09 06:39 PM
Forms - return keyed leaves square themillman Excel Programming 1 January 31st 06 04:01 AM
some email addresses aren't blue keyed in Excel, why? Artist999 Excel Discussion (Misc queries) 1 January 25th 06 06:52 PM
Help w/ macro to zero hard keyed numbers Mike Piazza Excel Programming 6 March 14th 05 10:29 PM


All times are GMT +1. The time now is 07:15 PM.

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"