Open a program based on users/ install?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smlrwd

    #1

    Open a program based on users/ install?

    I am trying to have access call a program that is installed in the users directory. It is required that every user installs the program seperately (license).

    This is what it looks like now.

    Code:
    Dim Apath As String
    Dim retVal1
         Apath = "  " & strA
     
          retVal1 = Shell ("C:\Users\joe.blow\AppData\Local\Company\Software\the.exe", 1)
          Sleep 400
    But how would I make it so that instead of it looking for joe blow's exe every time it looked for the current user's exe.

    I've been to http://mvps.org/access/api/api0054.htm but those refferences don't make any sense to me.

    Any help would be appreciated.
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    I've found that the only way around this problem traditionally is to install any files I want to be able to access in the All Users directory on the hard drive as opposed to any individual profile.

    In other words access would be...

    Code:
    retVal1 = Shell ("C:\Users\All Users\AppData\Local\Company\Software\the.exe", 1)
    Can't remember exactly what this looks like on Vista/W7 but you get the idea.
    Last edited by MMcCarthy; Oct 8 '10, 09:02 PM.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      Try :
      Code:
      retVal1 = Shell(Environ("USERPROFILE") & "\AppData\Local\Company\Software\The.exe")

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Of course, if the licensing allowed you to use the All Users' profile instead, you would be better off (using) :
        Code:
        retVal1 = Shell(Environ("ALLUSERSPROFILE") & "\AppData\Local\Company\Software\The.exe")

        Comment

        Working...