Pop-up Combo Box

B

Brad E

There is a spreadsheet which four people will be using,
and I need to know which of the four will be using for
formatting. Upon opening the 'template' workbook, I would
like a pop-up drop-down list of the user's names, which
they will have to select before entering on the
spreadsheet.
I would like to know two things: 1)how do I make the Combo
Box pop-up, 2)how do I make this pop up when the workbook
is open?
Thanks, Brad E.
 
B

Bob Phillips

Brad,

don't bother. Use this function to get the user name

Public Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long

Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
cChars = 256
If GetUserName(sName, cChars) Then
UserName = Left$(sName, cChars - 1)
End If
End Function

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
F

Frank Kabel

Hi Brad
for the second question use either the workbook_open event (in your
workbook module) or name your macro Auto_Open()
 
B

Bob Phillips

Frank,

If he takes my advice (and why wouldn't he<vbg>?) the second question
becomes redundant.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
F

Frank Kabel

Hi Bob
he should but I did not see your advice? (or was this a different post)
 
B

Bob Phillips

Frank,

That's odd isn't it. I see it okay, I wonder if the OP can. This is what I
put

Brad,

don't bother. Use this function to get the user name

Public Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long

Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
cChars = 256
If GetUserName(sName, cChars) Then
UserName = Left$(sName, cChars - 1)
End If
End Function


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top