Solved

Search For Ext in AppDir

Posted on 2006-06-19
1
589 Views
Last Modified: 2008-01-09
I need to search my app.path dir for a file with ext. (.wrg) i just need the first filename it finds and if it finds more then just debug.print filename
0
Comment
Question by:thaburner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 200 total points
ID: 16936780
Here's a quick example. Just change ext to "*.wrg".

Form1:
-----------------
Option Explicit
Private Sub Form_Load()
    Dim path As String
    Dim ext As String
    Dim file As String
    path = App.path
    If (Right$(path, 1) <> "\") Then
        path = path & "\"
    End If
    ext = "*.HTM"
    file = Dir(path & ext, vbNormal)
    Do Until file = vbNullString
        Debug.Print file
        file = Dir
    Loop
End Sub
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

737 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