Do I use a command button or how what can I use to execute all these codes I place them in different modules without sucession?
Code:
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
Code:
'Show date and time when last saved
Function LastSaved(FullPath As String) As Date
LastSaved = FileDateTime(FullPath)
End Function
Function DateTime()
DateTime = Now
End Function
Code:
'Workbook Name
Function MyFullName() As String
MyFullName = ThisWorkbook.FullName
End Function
Last edited by a moderator: