+ Reply to Thread
Results 1 to 8 of 8

VB code to check if file exit before opening excel file.

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB code to check if file exit before opening excel file.

    Hello:

    I need a VB Code to check the following when i open any excel file.

    Need to check if C:\User\test.xlb exist.

    If this file exist then open the excel file otherwise give message and close the excel file.

    Please let me know if you have any questions.
    Thanks.

    Riz

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VB code to check if file exit before opening excel file.

    Hi Riz,

    Try this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to check if file exit before opening excel file.

    Hello xlaDept:

    Thanks and i will try and let you know if any problem.
    I know it will work as i get this from expert..
    Thanks a lot

    Riz

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VB code to check if file exit before opening excel file.

    You're welcome and thanks for the rep and for the compliment!!

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to check if file exit before opening excel file.

    Hello xladept:

    I think there is misunderstanding.
    Assume i am opening file C:\Dropbox\XYZ.xls
    Now while opening the file, it needs to check if C:\User\test.xlb exit.
    If it exist then open C:\Dropbox\XYZ.xls
    If file does not exist then exit sub.

    I hope this is clear.
    Thanks

    Riz

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VB code to check if file exit before opening excel file.

    Maybe:

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to check if file exit before opening excel file.

    Hi xla:

    Thanks a lot, works.

    Riz

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VB code to check if file exit before opening excel file.

    Excellent!

+ 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. How to check if excel file is Checked Out in SharePoing Check Out, run code, Check In
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-08-2016, 04:36 PM
  2. Check file format before opening Excel file
    By stroll11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2015, 03:45 PM
  3. vba code for opening excel file and insert a new column in exisiting excel file
    By saratu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-21-2014, 02:55 PM
  4. check if file exists and opening it based on file date
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-26-2014, 03:45 AM
  5. [SOLVED] VBA code for opening a file with a variable version number in the file name
    By trishcollins in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-04-2014, 04:38 PM
  6. [SOLVED] Error in code - play music file automatically after opening file
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-15-2013, 10:06 AM
  7. [SOLVED] code to check file size everytime an Excel file is opened
    By Kaiser in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2006, 12:50 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