#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
use of wildcards italiavb Excel Worksheet Functions 5 July 14th 06 05:48 AM
Wildcards in RTD JKC Excel Discussion (Misc queries) 0 February 3rd 06 07:35 PM
Wildcards irresistible007 Excel Worksheet Functions 2 December 20th 05 10:12 AM
Use wildcards furia Excel Discussion (Misc queries) 0 November 16th 05 06:23 PM
VBA Wildcards - HELP! Co-op Bank Charts and Charting in Excel 1 March 30th 05 02:37 PM


All times are GMT +1. The time now is 08:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"