A) This will disable a CommandBar called "ply"
B) See code:
Not really sure what your questions are!VB:Sub doit() MsgBox ReturnComputerName() End Sub
TJ
Hi there
could u pls reemind me of what is this?
Application.CommandBars("ply").Enabled = False
--------------------------------------------------------
Could u pls tell me how to use this code ?
i tried them, but............
Function for returning the computer name
'The function below will return the computer name for the
' machine running the code, works in both Windows NT and Windows95/98.
VB:Private Declare Function GetComputerName Lib "kernel32" _ Alias "GetComputerNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long Function ReturnComputerName() As String Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next sLen = GetComputerName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen > 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error Goto 0 ReturnComputerName = UCase(Trim(tString)) End Function
and this code as well:
Function for returning the user name
'The function below will return the user name for the logged on user,
'works in both Windows NT and Windows95/98.
VB:Public Declare Function GetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function ReturnUserName() As String ' returns the NT Domain User Name Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next sLen = GetUserName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen > 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error Goto 0 ReturnUserName = UCase(Trim(tString)) End Function 'If you don't want to return the network user name, but want to return the 'user name that the user has registered with the application you can do this: ActiveUserName = Application.UserName
******************
Yours
h
Your Help Is Highly Appreciated
A) This will disable a CommandBar called "ply"
B) See code:
Not really sure what your questions are!VB:Sub doit() MsgBox ReturnComputerName() End Sub
TJ
Oh dear I need a beer
Online Motorsport Game
Hi h,
The Ply commandbar is one of the right-click menubars (the sheet tab one). That line is disabling it - give it a try!
The functions just return string values for your use:
HTHVB:Private Declare Function GetComputerName Lib "kernel32" _ Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Public Declare Function GetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function ReturnComputerName() As String Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next sLen = GetComputerName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen > 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error Goto 0 ReturnComputerName = UCase(Trim(tString)) End Function Function ReturnUserName() As String ' returns the NT Domain User Name Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next sLen = GetUserName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen > 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error Goto 0 ReturnUserName = UCase(Trim(tString)) End Function Sub Testem() MsgBox "Computername : " & ReturnComputerName & vbNewLine & _ "Username : " & ReturnUserName End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks