+ Reply to Thread
Results 1 to 9 of 9

how do i open up a file knowing the first part of the filename in excel using vba

  1. #1
    Registered User
    Join Date
    05-10-2013
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    19

    how do i open up a file knowing the first part of the filename in excel using vba

    Hi,

    I'm trying to open a file in excel using VBA but all I want to use is the first 6 numbers like (70000 city, state. xlsm) but I can't figure out the wild cards. if someone could help me I would appreciate it.

    Please Login or Register  to view this content.
    Thanks,
    Brian

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: how do i open up a file knowing the first part of the filename in excel using vba

    See how next code can help, customize Constantes to your need
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    05-10-2013
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: how do i open up a file knowing the first part of the filename in excel using vba

    PCI,

    Thank you for you help I think I might explained it wrong the only thing that is constant is the number length which is 6 numbers, the 6 numbers change along with city and state. I have people that use this excel program to open files but they only know the job number which is the 6 numbers., so I'm trying to get it to where all they have to do is put in just the 6 numbers and not have to worry about the city and state.

    Thanks,
    Brian.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: how do i open up a file knowing the first part of the filename in excel using vba

    Maybe this:
    Please Login or Register  to view this content.
    Last edited by alansidman; 04-22-2019 at 02:59 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    05-10-2013
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: how do i open up a file knowing the first part of the filename in excel using vba

    PCI,

    that didn't work it keeps giving me an error
    Please Login or Register  to view this content.
    .

    thanks
    Brian

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: how do i open up a file knowing the first part of the filename in excel using vba

    amended code. See post 4 again.

  7. #7
    Registered User
    Join Date
    05-10-2013
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: how do i open up a file knowing the first part of the filename in excel using vba

    awesome!!!! It worked great!! Thank you!!!
    Last edited by BrianTFC; 04-29-2019 at 09:19 AM.

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: how do i open up a file knowing the first part of the filename in excel using vba

    In post 4, I would suggest to remove
    Please Login or Register  to view this content.

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: how do i open up a file knowing the first part of the filename in excel using vba

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 5
    Last Post: 08-08-2018, 05:05 AM
  2. VBA Opening a file when only part of filename is known
    By Mastaglio in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-25-2017, 03:21 AM
  3. Open word file with partial filename from excel
    By Eatmybrain in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-29-2016, 02:12 PM
  4. Excel connot open file (filename) xlsx
    By dengeorge6 in forum Excel General
    Replies: 1
    Last Post: 12-12-2014, 07:49 AM
  5. Open File in Directory with a Part of Filename as String
    By paesu57 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-11-2014, 06:27 AM
  6. [SOLVED] Open excel file by providing a part of file name through inputbox
    By sbabu16 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2014, 05:30 AM
  7. Replies: 4
    Last Post: 10-23-2013, 12:54 AM

Tags for this Thread

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