Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
MissGenie
 
Posts: n/a
Default 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
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

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
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
How do I set my color default for gridlines & text? Excel default grid colors Setting up and Configuration of Excel 1 April 11th 05 10:24 PM
Adding default comment text dshigley Excel Discussion (Misc queries) 1 April 8th 05 05:26 PM
Set "print all text as black" as default in Excel CMK Excel Worksheet Functions 0 January 25th 05 08:31 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM
how do i set default font / text size in comments? philk Setting up and Configuration of Excel 1 November 28th 04 03:20 PM


All times are GMT +1. The time now is 04:06 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"