+ Reply to Thread
Results 1 to 15 of 15

E-Signature by username

  1. #1
    Registered User
    Join Date
    08-03-2005
    Posts
    18

    E-Signature by username

    I have a spreadsheet application that we use in our office to produce construction Bids. Our estimators currently insert an electronic signature (scanned image of signature) into the Bid worksheet manually (Insert ->Picture-> From File->). I am trying find out how to automate the process with the use of a button/macro. If, user1 is working in the worksheet and presses the button it will grab the user1 signature file from the server and insert it into the sheet. Any ideas?

    Thanks

  2. #2
    Carim
    Guest

    Re: E-Signature by username

    Hi,

    With a macro
    Sub Macro1()
    ActiveSheet.Pictures.Insert("D:\My Documents\My Pictures.gif").Select
    End Sub

    HTH
    Carim


  3. #3
    Registered User
    Join Date
    08-03-2005
    Posts
    18
    problem is they all access the same workbook to begin with. the pull of the signature needs to be tied to a username. Like :

    Sub Macro1()
    ActiveSheet.Pictures.Insert("D:\FileServer\current_user.gif").Select
    End Sub

  4. #4
    Carim
    Guest

    Re: E-Signature by username

    If current_user is a variable which is captured at an earlier stage, it
    is OK ...
    otherwise, you will have to ask for it with an inputbox ...

    HTH
    Carim


  5. #5
    Registered User
    Join Date
    08-03-2005
    Posts
    18
    i need help with the code for the macro

  6. #6
    Eric White
    Guest

    Re: E-Signature by username

    Dim strSignaturePath as String
    Dim x as Single
    Dim y as Single

    'These are the coordinates for where the signature needs to go,
    'in points. The values will be different for you application.
    x = 285.6
    y = 285.6

    Select Case Application.UserName
    Case "EstimatorA"
    str = "c:\signaturefolder\signatureA.gif"
    Case "EstimatorB"
    str = "c:\signaturefolder\signatureB.gif"
    Case "EstimatorC"
    str = "c:\signaturefolder\signatureC.gif"

    '... ad nauseum

    End Select

    ActiveSheet.Pictures.Insert(strSignaturePath).Select
    With Selection.ShapeRange
    .IncrementLeft x
    .IncrementTop y
    End With



    "maximus73" wrote:

    >
    > problem is they all access the same workbook to begin with. the pull of
    > the signature needs to be tied to a username. Like :
    >
    > Sub Macro1()
    > ActiveSheet.Pictures.Insert("D:\FileServer\current_user.gif").Select
    > End Sub
    >
    >
    > --
    > maximus73
    > ------------------------------------------------------------------------
    > maximus73's Profile: http://www.excelforum.com/member.php...o&userid=25877
    > View this thread: http://www.excelforum.com/showthread...hreadid=522752
    >
    >


  7. #7
    Registered User
    Join Date
    08-03-2005
    Posts
    18
    Thanks for the help. I think we are almost there. When I run the code I am getting:

    Runtime error '1004':

    Unable to get the Insert property of the Pictures class

    ???

  8. #8
    Registered User
    Join Date
    08-03-2005
    Posts
    18
    why does the Insert work if i put in a complete path? if i use a variable for the path it doesn't.

  9. #9
    GS
    Guest

    Re: E-Signature by username

    Hi maximus73,

    If you're referring to Eric's code regarding the variables, the declared
    variable is:
    strSignaturePath

    the "loaded" variable used is:

    str="..."

    the passed variabled is the same as the declared one, so make some changes
    here and it should work as posted.

    HTH
    Regards,
    GS

  10. #10
    Art H
    Guest

    Re: E-Signature by username

    Did you consider the path separator (e.g., \)? There is a property that
    is system dependent if that's important. Use
    "Application.PathSeparator" (without the quotes) to return the path
    separator. Anyway, compare the two paths--the one typed in and the one
    using the variable.

    BTW, you might consider using the Environ function to return the user
    name.
    for example:
    Function GetUserName() As String
    GetUserName = Environ("Username")
    End Function

    Art


    maximus73 wrote:
    > why does the Insert work if i put in a complete path? if i use a
    > variable for the path it doesn't.
    >
    >
    > --
    > maximus73
    > ------------------------------------------------------------------------
    > maximus73's Profile: http://www.excelforum.com/member.php...o&userid=25877
    > View this thread: http://www.excelforum.com/showthread...hreadid=522752



  11. #11
    Registered User
    Join Date
    08-03-2005
    Posts
    18
    The code is working properly. It comes down to which the Case "username" for some reason the username is either "username" or "uname". I created two case statements for each user.

    How can I find out what username is being pulled by Excel? I am not sure how or where to place the username code that you provided.

    Thanks

  12. #12
    GS
    Guest

    Re: E-Signature by username

    Hi maximus73,

    Application.UserName

    is a read/write property that contains what's been entered in the "User
    name:" box on the Tools>Options...>General tab (last item).

    It might be more practical to just have your users "Insert" their own
    signatures because to do this how you want requires modifying your code to
    include each user's .UserName. (..just a suggestion!)

    Eric's code is constructed properly and will work as long as you replace his
    "example usernames" with "actual usernames" for each 'Case Is' line. Include
    lines for each user.

    HTH
    Regards,
    GS

  13. #13
    GS
    Guest

    Re: E-Signature by username

    Hi maximus73,

    Application.UserName

    is a read/write property that contains what's been entered in the "User
    name:" box on the Tools>Options...>General tab (last item).

    It might be more practical to just have your users "Insert" their own
    signatures because to do this how you want requires modifying your code to
    include each user's .UserName. (..just a suggestion!)

    Eric's code is constructed properly and will work as long as you replace his
    "example usernames" with "actual usernames" for each 'Case Is' line. Include
    lines for each user.

    HTH
    Regards,
    GS

  14. #14
    Art H
    Guest

    Re: E-Signature by username

    Application.UserName returns what the user entered in Word's User
    Information tab (Tools-> Options-> User Information tab-> Name).
    Environ("Username") returns the value of an operating system
    environment variable. I have Windows XP. Could be that different OSs
    use different names for similar information (e.g., username versus
    uname).

    You could replace Application.UserName in your sample posted code with
    Environ("Username"). It's your choice. One thing to consider is the
    user may easily change Application.UserName, which could result in
    breaking your code. Whereas, the OS user name (i.e., the login name)
    usually needs an administrator to change. In any event, it might be a
    good idea to have a default case for when the code does not find a
    match.

    Art


  15. #15
    GS
    Guest

    Re: E-Signature by username

    Art raises a good point! -A much better alternative!

    In the case of the username, the code, as written, needs to be maintained if
    changes occur with users.

    In the case of my suggestion to have users "Insert..." their own signature,
    it leaves room for error & foul play.

    IMO I'd prefer Art's suggestion!

    Regards,
    GS

    "Art H" wrote:

    > Application.UserName returns what the user entered in Word's User
    > Information tab (Tools-> Options-> User Information tab-> Name).
    > Environ("Username") returns the value of an operating system
    > environment variable. I have Windows XP. Could be that different OSs
    > use different names for similar information (e.g., username versus
    > uname).
    >
    > You could replace Application.UserName in your sample posted code with
    > Environ("Username"). It's your choice. One thing to consider is the
    > user may easily change Application.UserName, which could result in
    > breaking your code. Whereas, the OS user name (i.e., the login name)
    > usually needs an administrator to change. In any event, it might be a
    > good idea to have a default case for when the code does not find a
    > match.
    >
    > Art
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1