+ Reply to Thread
Results 1 to 3 of 3

File found, but cannot open

Hybrid View

paesu57 File found, but cannot open 03-12-2014, 05:14 AM
millz Re: File found, but cannot... 03-12-2014, 05:17 AM
paesu57 Re: File found, but cannot... 03-12-2014, 05:25 AM
  1. #1
    Registered User
    Join Date
    03-11-2014
    Location
    Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    37

    File found, but cannot open

    Hi all
    I have code that searches files in a folder, and gives me the filenames in MsgBox.

    Sub LoopThroughFiles()
    Dim wkbk As Workbook
    Dim filename As String


    Dim MyObj As Object, MySource As Object, file As Variant
    file = Dir("C:\Test\Projects\")
    Do While (file <> "")
    If InStr(file, "Forecast") > 0 Then
    MsgBox file

    End If
    file = Dir
    Loop


    End Sub



    but when i want to open the found files with Workbooks.open(file), instead of MsgBox file, it says "file not found"

    Can anyone help?

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: File found, but cannot open

    Hi paesu57, you already have another thread addressing the same issue. Did you see my response there?
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    03-11-2014
    Location
    Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: File found, but cannot open

    Yes i saw it, thank you! I just opened this thread before i saw it, tried a different approach here =)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. A file iis found if I open Excel FIRST, but not if I open the file by double-clicking
    By Ed_Collins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2013, 01:52 AM
  2. Macro to open file if found in a folder or any subfolders
    By beze12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2012, 02:27 AM
  3. Replies: 7
    Last Post: 07-25-2011, 10:00 AM
  4. [SOLVED] Close an Excel file if is found it open.
    By maperalia in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-07-2006, 06:42 AM
  5. File Not Found menu pops up after I open a file
    By Harveytunes in forum Excel General
    Replies: 3
    Last Post: 01-27-2006, 03:25 PM

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