Solved

Find File Directory

Posted on 2013-05-15
2
290 Views
Last Modified: 2013-05-15
I would like a VB.Net or even VBA script that looks on the C:\ drive for an executeable and then sets a string variable to that path.

It would search only C:\Program Files\ or C:\Program Files (x86)\ folders

Once file is found it stops

myExecuteablePath = "foundFullPath"
0
Comment
Question by:lrbrister
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39169432
dim strExe as string, strPath as string

strPath="C:\Program Files\"
strExe=dir(strPath & "*.exe")

while strExe <>""

      msgbox "The executable is " & strpath & strExe

      strExe=dir()
wend


strPath="C:\Program Files (x86)\"

strExe=dir(strPath & "*.exe")

while strExe <>""

      msgbox "The executable is " & strpath & strExe

      strExe=dir()
wend
0
 

Author Closing Comment

by:lrbrister
ID: 39169488
capricorn1

I mistated my question, which you answered correctly and efficiently.

I'm awarding points.
Please watch for new question
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question