Difference between revisions of "Microsoft Access modWsh"
Jump to navigation
Jump to search
(Created page with '=== getUserName === <syntaxhighlight lang="vb"> Function getUserName() As String Dim strResult As String Dim wshNet As WshNetwork Set wshNet = New WshNetwor...') |
|||
Line 1: | Line 1: | ||
+ | [[Category:Microsoft Access]] | ||
+ | [[Category:VBA]] | ||
=== getUserName === | === getUserName === | ||
<syntaxhighlight lang="vb"> | <syntaxhighlight lang="vb"> |
Revision as of 15:47, 15 July 2010
getUserName
Function getUserName() As String
Dim strResult As String
Dim wshNet As WshNetwork
Set wshNet = New WshNetwork
strResult = wshNet.UserName
getUserName = strResult
End Function
getComputerName
Function getComputerName() As String
Dim strResult As String
Dim wshNet As WshNetwork
Set wshNet = New WshNetwork
strResult = wshNet.ComputerName
getComputerName = strResult
End Function
getUserSuffix
Public Function getUserSuffix() As String
Dim strResult As String
strResult = getUserName
strResult = Replace(strResult, ".", "")
strResult = Replace(strResult, ",", "")
strResult = Replace(strResult, "-", "")
strResult = Replace(strResult, " ", "")
strResult = "_" & strResult
getUserSuffix = strResult
End Function
getUserTempTable
Public Function getUserTempTable(strSource As String) As String
Dim strResult As String
Const strTablePrefix = "_tbl"
strResult = strTablePrefix & Mid(strSource, 4) & getUserSuffix
getUserTempTable = strResult
End Function