D
Doctorjones_md
I have a Command Button on a worksheet that I only want to display if a
specified User Opens the workbook.
I have the following code:
(in a UserName module)
=================
' By Chris Rae, 14/6/99, 3/9/00.
Option Explicit
' This is used by GetUserName() to find the current user's
' name from the API
Declare Function Get_User_Name Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long) As Long
Function GetUserName() As String
Dim lpBuff As String * 25
Dim txtName As String
Get_User_Name lpBuff, 25
GetUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
txtName = lpBuff
MsgBox ("Welcome to the NEW Pricing Tool " & (lpBuff)), vbOKOnly
End Function
====================
How would I modify the code to enable the cmdQC button? I was thinking
something like the following ...
(In the code for the worksheet)
Sub Autpen()
GetUserName
If lpBuff = 'Person's UserName' then cmdQC.visible.True
End Sub
Many thanks (in advance) for your assistance.
Shane
specified User Opens the workbook.
I have the following code:
(in a UserName module)
=================
' By Chris Rae, 14/6/99, 3/9/00.
Option Explicit
' This is used by GetUserName() to find the current user's
' name from the API
Declare Function Get_User_Name Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long) As Long
Function GetUserName() As String
Dim lpBuff As String * 25
Dim txtName As String
Get_User_Name lpBuff, 25
GetUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
txtName = lpBuff
MsgBox ("Welcome to the NEW Pricing Tool " & (lpBuff)), vbOKOnly
End Function
====================
How would I modify the code to enable the cmdQC button? I was thinking
something like the following ...
(In the code for the worksheet)
Sub Autpen()
GetUserName
If lpBuff = 'Person's UserName' then cmdQC.visible.True
End Sub
Many thanks (in advance) for your assistance.
Shane