+ Reply to Thread
Results 1 to 4 of 4

How to check if Software is loaded on a users C: drive

  1. #1
    ExcelMonkey
    Guest

    How to check if Software is loaded on a users C: drive

    I want to check and see if certain software exists on a users C drive. For
    example, lets say hypothetically, I wanted to know if XYZ App existed on the
    hard drive.

    1) Extract User Name of Computer
    2) Check for software in predetermined path (including User Name)
    3) Generate Boolean Value for software existence

    The file path is: C:\Documents and Settings\User Name\Start Menu\Programs.
    Lets say the folder of the software is called XYZ App. Finding the folder is
    probably enough. I will likely want to go further than that to ensure that
    the software is actually on the C drive. So lets say the EXE is called XYZ
    App.EXE. So the full path is

    C:\Documents and Settings\User Name\Start Menu\Programs\XYZ App\XYZ App.EXE

    How do you check to see if the file exists?

    Thanks

  2. #2
    Tom Ogilvy
    Guest

    Re: How to check if Software is loaded on a users C: drive

    Possibly:

    sUsername = Environ("Username")
    sStr = "C:\Documents and Settings\" & sUserName & _
    "\Start Menu\Programs\XYZ App\XYZ App.EXE"

    if dir(sStr) = "" then
    ' not found

    I would assume you are distributing in a very small regimented environment.

    --
    Regards,
    Tom Ogilvy


    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    > I want to check and see if certain software exists on a users C drive.

    For
    > example, lets say hypothetically, I wanted to know if XYZ App existed on

    the
    > hard drive.
    >
    > 1) Extract User Name of Computer
    > 2) Check for software in predetermined path (including User Name)
    > 3) Generate Boolean Value for software existence
    >
    > The file path is: C:\Documents and Settings\User Name\Start Menu\Programs.
    > Lets say the folder of the software is called XYZ App. Finding the folder

    is
    > probably enough. I will likely want to go further than that to ensure that
    > the software is actually on the C drive. So lets say the EXE is called

    XYZ
    > App.EXE. So the full path is
    >
    > C:\Documents and Settings\User Name\Start Menu\Programs\XYZ App\XYZ

    App.EXE
    >
    > How do you check to see if the file exists?
    >
    > Thanks




  3. #3
    Bob Phillips
    Guest

    Re: How to check if Software is loaded on a users C: drive

    Here is a simple function to construct the string and test it

    '-----------------------------------------------------------------
    Function FileExists(Filename) As Boolean
    '-----------------------------------------------------------------
    Dim sFile As String
    sFile = "C:\Documents and Settings\" & Environ("UserName") & _
    "\Start Menu\Programs\" & Filename

    On Error Resume Next
    sFile = Dir(sFile)
    FileExists = sFile <> ""
    End Function

    Call like Msgbox FileExists("myAp.exe")

    But won't the files in that directory all be shortcuts, if so, add .lnk at
    the end.

    --
    HTH

    Bob Phillips

    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    > I want to check and see if certain software exists on a users C drive.

    For
    > example, lets say hypothetically, I wanted to know if XYZ App existed on

    the
    > hard drive.
    >
    > 1) Extract User Name of Computer
    > 2) Check for software in predetermined path (including User Name)
    > 3) Generate Boolean Value for software existence
    >
    > The file path is: C:\Documents and Settings\User Name\Start Menu\Programs.
    > Lets say the folder of the software is called XYZ App. Finding the folder

    is
    > probably enough. I will likely want to go further than that to ensure that
    > the software is actually on the C drive. So lets say the EXE is called

    XYZ
    > App.EXE. So the full path is
    >
    > C:\Documents and Settings\User Name\Start Menu\Programs\XYZ App\XYZ

    App.EXE
    >
    > How do you check to see if the file exists?
    >
    > Thanks




  4. #4
    ExcelMonkey
    Guest

    Re: How to check if Software is loaded on a users C: drive

    Yes Bob I think you are right about the shortcuts. Thanks. And to answer
    Toms question, I am putting in this check to see if software exists as a
    means of ensuring that the user is using the macro on a company computer.
    Every computer in my firm has this software. The check is simply a means of
    authenticating the computer (i.e. the user).

    Thanks

    EM

    "Bob Phillips" wrote:

    > Here is a simple function to construct the string and test it
    >
    > '-----------------------------------------------------------------
    > Function FileExists(Filename) As Boolean
    > '-----------------------------------------------------------------
    > Dim sFile As String
    > sFile = "C:\Documents and Settings\" & Environ("UserName") & _
    > "\Start Menu\Programs\" & Filename
    >
    > On Error Resume Next
    > sFile = Dir(sFile)
    > FileExists = sFile <> ""
    > End Function
    >
    > Call like Msgbox FileExists("myAp.exe")
    >
    > But won't the files in that directory all be shortcuts, if so, add .lnk at
    > the end.
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "ExcelMonkey" <[email protected]> wrote in message
    > news:[email protected]...
    > > I want to check and see if certain software exists on a users C drive.

    > For
    > > example, lets say hypothetically, I wanted to know if XYZ App existed on

    > the
    > > hard drive.
    > >
    > > 1) Extract User Name of Computer
    > > 2) Check for software in predetermined path (including User Name)
    > > 3) Generate Boolean Value for software existence
    > >
    > > The file path is: C:\Documents and Settings\User Name\Start Menu\Programs.
    > > Lets say the folder of the software is called XYZ App. Finding the folder

    > is
    > > probably enough. I will likely want to go further than that to ensure that
    > > the software is actually on the C drive. So lets say the EXE is called

    > XYZ
    > > App.EXE. So the full path is
    > >
    > > C:\Documents and Settings\User Name\Start Menu\Programs\XYZ App\XYZ

    > App.EXE
    > >
    > > How do you check to see if the file exists?
    > >
    > > Thanks

    >
    >
    >


+ 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