Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcards
Is there a way that I can modify a macro from an
individuals location (i.e. C:\Documents and Settings\turdavl\Desktop\Davidsig.JPG") to a wildcard search? (Note: I am trying to create a macro in a template to enable users to place their individual signatures into a cell (insert object). Thanks in advance. John Petty |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcards
John
well, you can get the User's Logon ID using the following routines: Private Declare Function apiGetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nsize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If lngX < 0 Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = "" End If End Function Sub GetUserNameTest() MsgBox fOSUserName End Sub You could then build the folder name as: "C:\Documents and Settings\" & fOSUserName & "\Desktop\DefaultSig.JPG" for example ... though this does imply you have a default name for the signature file, or use the Logon ID again. Regards Trevor "john Petty" wrote in message ... Is there a way that I can modify a macro from an individuals location (i.e. C:\Documents and Settings\turdavl\Desktop\Davidsig.JPG") to a wildcard search? (Note: I am trying to create a macro in a template to enable users to place their individual signatures into a cell (insert object). Thanks in advance. John Petty |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcards
Thank you Trevor. You da Man.
-----Original Message----- John well, you can get the User's Logon ID using the following routines: Private Declare Function apiGetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nsize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If lngX < 0 Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = "" End If End Function Sub GetUserNameTest() MsgBox fOSUserName End Sub You could then build the folder name as: "C:\Documents and Settings\" & fOSUserName & "\Desktop\DefaultSig.JPG" for example ... though this does imply you have a default name for the signature file, or use the Logon ID again. Regards Trevor "john Petty" wrote in message ... Is there a way that I can modify a macro from an individuals location (i.e. C:\Documents and Settings\turdavl\Desktop\Davidsig.JPG") to a wildcard search? (Note: I am trying to create a macro in a template to enable users to place their individual signatures into a cell (insert object). Thanks in advance. John Petty . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcards
John
you're welcome. I have to admit that the code MUST have come from the group at some point in time so the credit, sadly, is not all mine. Still, it makes me feel good to be help others as I have been helped. Regards Trevor "John Petty" wrote in message ... Thank you Trevor. You da Man. -----Original Message----- John well, you can get the User's Logon ID using the following routines: Private Declare Function apiGetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nsize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If lngX < 0 Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = "" End If End Function Sub GetUserNameTest() MsgBox fOSUserName End Sub You could then build the folder name as: "C:\Documents and Settings\" & fOSUserName & "\Desktop\DefaultSig.JPG" for example ... though this does imply you have a default name for the signature file, or use the Logon ID again. Regards Trevor "john Petty" wrote in message ... Is there a way that I can modify a macro from an individuals location (i.e. C:\Documents and Settings\turdavl\Desktop\Davidsig.JPG") to a wildcard search? (Note: I am trying to create a macro in a template to enable users to place their individual signatures into a cell (insert object). Thanks in advance. John Petty . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
use of wildcards | Excel Worksheet Functions | |||
Wildcards in RTD | Excel Discussion (Misc queries) | |||
Wildcards | Excel Worksheet Functions | |||
Use wildcards | Excel Discussion (Misc queries) | |||
VBA Wildcards - HELP! | Charts and Charting in Excel |