Results 1 to 1 of 1

Thread: Macro to open and update several workbooks

  1. #1
    Member
    Join Date
    Aug 2012
    Posts
    40
    Rep Power
    0

    Macro to open and update several workbooks

    I have the following code which is used to open up workbooks one by one and to update these . The source workbooks in CSV format are in the folder C:\downloads. However, I need to open each file individually and then select the file in C:\downloads in order for the destination file to be updated

    The downloaded files are in C:\downloads and the destination workbooks are in C:\Parts & SVC Sales

    The workbooks in C:\Parts & SVC Sales contains and name and division

    for eg Br1 parts sales , Br1 Service Sales

    When opening the files , the files for parts sales for EG Br1 Parts Sales must be updated to file containing a similar name (in C:\downloads) and must contain in the file name "salesperson" for eg Br1 Salesperson 01-07-2014


    When opening the files , the files for service sales for eg Br1 Service sales must be updated to file containing a similar name (in C:\downloads) + must contain in the file name "" for eg Br1 Service ooder repair register 01-07-2014

    When comparing the name in the distination file to the source file, the name can be anywhere in the source file

    Code:
     Sub Update_Workbooks()
       ChDir ("C:\Parts & SVC Sales")
        Application.DisplayAlerts = False
        fPath = Application.GetOpenFilename
        fName = Mid(fPath, Len("C:\Parts & SVC Sales") + 2)
        Workbooks.Open (fPath)
        Application.Run "'" & fName & "'!Auto_Update"
            ActiveWorkbook.Save
            ActiveWorkbook.Close
            CloseCSV
    End Sub
    See link to file examples


    https://www.dropbox.com/s/dwf8ytgnnf79uia/Dropbox.rar

    Your assistance in opening and updating the files simultaneously is much appreciated
    Last edited by Flupsie; 08-07-2014 at 10:46 PM.

Similar Threads

  1. Open And Activate Workbook Before Runing Macro
    By Howardc in forum Excel Help
    Replies: 5
    Last Post: 06-04-2013, 07:23 PM
  2. Replies: 7
    Last Post: 05-09-2013, 11:16 PM
  3. Excel VBA Macro To Open A File Through Browse Dialog Box
    By Safal Shrestha in forum Excel Help
    Replies: 2
    Last Post: 04-05-2013, 12:59 PM
  4. Replies: 1
    Last Post: 03-30-2013, 11:48 PM
  5. Save each Worksheets as Macro disabled workbooks
    By nickface in forum Excel Help
    Replies: 1
    Last Post: 01-28-2013, 07:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •