Solved

Find File Directory

Posted on 2013-05-15
2
291 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

790 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