+ Reply to Thread
Results 1 to 11 of 11

VBA Open Specific File Type

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Open Specific File Type

    Hi, I wonder if someone could help me please.

    Using a source file I found here:http://www.learnexcelmacro.com/wp/20...d-sub-folders/, I've put together the following code which downloads a list of files when the workbook opens.

    Please Login or Register  to view this content.
    The problem I have is with this line:
    Please Login or Register  to view this content.
    where I'm trying to list a specific file type, but when I run the code I recieve a 'Path not found' error.

    I know the fPath is correct, but I just wondered whether someone could point out where I've gone wrong on trying to download a specific file type.

    Many thanks and kind regards

    Chris

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: VBA Open Specific File Type

    fPath = "XXXXXXXXXX"
    is not a file path

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Open Specific File Type

    Hi @davesexcel, thank you for taking the time to reply to my post.

    No it isn't but I didn't want to publish the real file path.

    Kind Regards

    Chris

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: VBA Open Specific File Type

    Can you attach a pic of the warning msg?

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Open Specific File Type

    Hi @davesexcel, forgive me but I'm not sure what a picture will show other than the error message. I can say though that debug does highlight this line as the cause:
    Please Login or Register  to view this content.
    .

    Many thanks and kind regards

    Chris
    Last edited by hobbiton73; 03-31-2015 at 01:55 AM.

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: VBA Open Specific File Type

    Show the darn file path, or a fake file path, who cares, I want to see how the file path looks.

  7. #7
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Open Specific File Type

    Hi @davesexcel, please find a file path as you asked for.

    fPath = "\\c\s\xxx\xxxxxx\xxxxxx\Dragon - Application-Specific Script Conversion 2014\Converted Scripts\Done\"

    Kind Regards

    Chris

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Open Specific File Type

    getfolder gets a reference to a folder not a file-it oughta be
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  9. #9
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Open Specific File Type

    Hi @JospehP, thank you for taking the time to reply to my post.

    Thank you for the giuidance, but can you tell me please how I fetch a specific file type then.

    Many thanks and kind regards

    Chris

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Open Specific File Type

    Please Login or Register  to view this content.
    you can sort by name, by size , by time using the /o switch



  11. #11
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Open Specific File Type

    Chris
    you oughta change the ListFilesInFolder routine so it checks the extension on the name of each file

+ 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. Use Macro to open a file with excel (underfined type of file)
    By tatfish87 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-21-2014, 09:38 PM
  2. [SOLVED] Open specific folder, select file to open and copy then paste
    By Kranky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-22-2012, 12:14 AM
  3. [SOLVED] Default file type to open in 2003
    By Circe in forum Excel General
    Replies: 2
    Last Post: 02-10-2006, 03:00 PM
  4. How to select a specific file type
    By MervB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2005, 04:10 AM
  5. Replies: 4
    Last Post: 02-18-2005, 10:06 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