Thread: Wildcards
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default 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