+ Reply to Thread
Results 1 to 5 of 5

Opening excel workbooks automatically

  1. #1
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Opening excel workbooks automatically

    HI,

    I have a folder named "SALES" :-(C:\GRANDVARIATIONS\SALES) in which there are about 30 separate excel workbooks. The first workbook in that folder is named "1st":- (C:\GRANDVARIATIONS\SALES\1st) . Each of those workbooks have a "command button" which runs vba , when clicked .

    Now, I'am looking for a vba code which a) OPENS THE FIRST WORKBOOK AT SALES FOLDER b) INITIATES THE COMMAND BUTTON IN THAT WORKBOOK c) WHEN THE FIRST WORKBOOK CLOSES IT AGAIN OPENS THE SECOND WORKBOOK d) REPEATS THE PROCESS UNTIL THE LAST WORKBOOK IN THAT FOLDER.

    Thank you

  2. #2
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    28,625

    Re: Opening excel workbooks automatically

    Hi,

    Put a Workbooks.Open FileName:= "second_file_Name" command in the Close event of the first workbook.
    Repeat in every subsequent workbook specifying the third, fourth etc.. workbook.

    Alterenatively create a Master Control workbook which contains nothing else apart from a macro to open, run and close every workbook.
    Richard Buttrey

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,833

    Re: Opening excel workbooks automatically

    This code will loop through the files in a directory and open each one:

    Please Login or Register  to view this content.
    If someone has helped you then please add to their Reputation

  4. #4
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: Opening excel workbooks automatically

    Hi, Richard

    Thanks for the reply,

    Actually i'am new to VBA codes, i just want to open those workbooks and run the codes in them , i don't need to close them because after running the codes , they close by themselves.

    Its just about opening and running the codes in them.

    Please do let me know about the codes format for master workbook.

    Cheers

  5. #5
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: Opening excel workbooks automatically

    @ pjwhitfield

    Thank you for the code,

    Does it also runs the code in those workbooks?

    Cheers

+ 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. Automatically maximize workbooks when opening
    By Carrfamily in forum Excel General
    Replies: 3
    Last Post: 08-18-2017, 06:17 PM
  2. Opening, Closing, and Opening Excel workbooks from MS Project
    By m007schneider in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2013, 03:22 PM
  3. Opening Workbooks Automatically Versus a User Opening Them
    By tmanes in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-04-2012, 03:00 AM
  4. opening workbooks automatically
    By sholom in forum Excel General
    Replies: 1
    Last Post: 11-13-2009, 05:41 AM
  5. Opening multiple workbooks in Excel through VB
    By Nick.Korynski@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-04-2006, 09:10 PM

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