How do I make a gif as a command button I placed it with assign macros already this is the code I want to run how do I do it? Its way beyond me
Sub Picture1Click_()
'Grap username into first sheet
Range("a1").Value = WinUsername()
End Sub
Private Declare Function WNetGetUSer Lib "mpr.dll" Alias "WNetGetUserA"_
(ByVal IpName As String, ByVal IpUserName As String. IpnLength As Long) As Long
Private Const NO_ERROR = 0
Private Const ERROR_NOT_CONNECTED = 2250&
Private Const ERROR_MORE_DATA = 234
Private Const ERROR_NO_NETWORK = 1222&
Private Const ERROR_EXTENDED_ERROR = 1208&
Private Const ERROR_NO_NET_BAD_PATH = 1203&
Function WinUsername() As String
Dim strBuf As String, IngUser As Long, strUn As String
strBuf = Space$(255)
IngUser = WNetGetUSer("", strBuf, 255)
If IngUser = NO_ERROR Then
strUn = Left(strBuf, InStr(strBuf, vbNullChar) - 1)
WinUsename = strUn
Else
WinUsername = "error:" & IngUser
End If
End Function
Sub CheckUserRights()
Dim UserName As String
UserName = WinUsername
Select Case UserName
Case "Adminstrator"
MsgBox "Full Rights"
Case "Guest"
MsgBox "You Cannot Make Changes"
Case Else
MsgBox "Limited Rights:"
End Select
End Sub
Sub Picture1Click_()
'Grap username into first sheet
Range("a1").Value = WinUsername()
End Sub
Private Declare Function WNetGetUSer Lib "mpr.dll" Alias "WNetGetUserA"_
(ByVal IpName As String, ByVal IpUserName As String. IpnLength As Long) As Long
Private Const NO_ERROR = 0
Private Const ERROR_NOT_CONNECTED = 2250&
Private Const ERROR_MORE_DATA = 234
Private Const ERROR_NO_NETWORK = 1222&
Private Const ERROR_EXTENDED_ERROR = 1208&
Private Const ERROR_NO_NET_BAD_PATH = 1203&
Function WinUsername() As String
Dim strBuf As String, IngUser As Long, strUn As String
strBuf = Space$(255)
IngUser = WNetGetUSer("", strBuf, 255)
If IngUser = NO_ERROR Then
strUn = Left(strBuf, InStr(strBuf, vbNullChar) - 1)
WinUsename = strUn
Else
WinUsername = "error:" & IngUser
End If
End Function
Sub CheckUserRights()
Dim UserName As String
UserName = WinUsername
Select Case UserName
Case "Adminstrator"
MsgBox "Full Rights"
Case "Guest"
MsgBox "You Cannot Make Changes"
Case Else
MsgBox "Limited Rights:"
End Select
End Sub