![]() |
Default text in textboxes
I have done this once but don't remember how. The licensee appears in all new
textboxes as a default and it can be prevented from appearing, which I would very much like to know how. Can anyone help me with this? Thanks |
You can use an API call to get the username:
Option Explicit Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If lngX < 0 Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = "" End If End Function 'not quite a textbox, but you can use it kind of like this: Sub testme() Dim resp As String resp = InputBox(prompt:="Hi there", Default:=fOSUserName) MsgBox resp End Sub MissGenie wrote: I have done this once but don't remember how. The licensee appears in all new textboxes as a default and it can be prevented from appearing, which I would very much like to know how. Can anyone help me with this? Thanks -- Dave Peterson |
All times are GMT +1. The time now is 07:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com