+ Reply to Thread
Results 1 to 3 of 3

Lookup & open file based on partial filename

Hybrid View

  1. #1
    Registered User
    Join Date
    05-09-2008
    Posts
    5

    Lookup & open file based on partial filename

    NVM! 10char
    Last edited by Im2bz2p345; 04-11-2011 at 06:32 PM. Reason: NVM! 10char

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Lookup & open file based on partial filename

    Come again???

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Lookup & open file based on partial filename

    Does this help ?

    Public Sub demo()
      ' Config Here !
      FullPath = "C:\test\"
      FileName = "*" & "Book" & "*" & "Mar" & "*"
      FileExt = ".xls"
      
      Call OpenFile(FullPath, FileName, FileExt)
    End Sub
    
    Public Sub OpenFile(FullPath, FileName, FileExt)
    On Error GoTo exitloop
     NextFile = Dir(FullPath & FileName & FileExt)
    
    
    Do While NextFile <> ""    ' Start the loop.
       NextFile = Dir
       Workbooks.Open FileName:=NextFile
    Loop
    exitloop:
    End Sub

+ 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