+ Reply to Thread
Results 1 to 10 of 10

Get data from closed workbook - ADO connection

Hybrid View

marzook Get data from closed workbook... 06-10-2013, 02:57 AM
patel45 Re: Get data from closed... 06-10-2013, 03:11 AM
marzook Re: Get data from closed... 06-10-2013, 04:09 AM
Kyle123 Re: Get data from closed... 06-10-2013, 04:11 AM
patel45 Re: Get data from closed... 06-10-2013, 04:34 AM
Kyle123 Re: Get data from closed... 06-10-2013, 04:36 AM
patel45 Re: Get data from closed... 06-10-2013, 05:32 AM
marzook Re: Get data from closed... 06-10-2013, 05:42 AM
marzook Re: Get data from closed... 06-10-2013, 03:19 PM
patel45 Re: Get data from closed... 06-11-2013, 01:43 AM
  1. #1
    Registered User
    Join Date
    01-04-2011
    Location
    Kuwait
    MS-Off Ver
    Excel 2007
    Posts
    12

    Red face Get data from closed workbook - ADO connection

    Hi..

    attached the file which get the data from closed workbook, basically it works with below steps. the code works fine only the problem is timing. it took long time to get the retrieve the data, is there any way to improve the code and speed up the process

    1. select the multiple files from certain folder called "Report"
    2. once its selected its copy the name of the worksheets from selected workbook and store in the sheet "Market Table"
    3. then its loop through each sheets in the closed workbook and get the data from the sheets and stored in the sheet "Consolidation"

    Please help..how i could speed the ado connection and get the data quickly

    Thanks
    Marzook
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Get data from closed workbook - ADO connection

    Your code opens the file, why do you use ADO connection for getting data from sheets ?

    sorry, the code does not open files
    Last edited by patel45; 06-10-2013 at 05:33 AM.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    01-04-2011
    Location
    Kuwait
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Get data from closed workbook - ADO connection

    thanks Patel- Yes, its open the files but the it takes long time to pull the data from the selected workbooks. there is aroung 50 workbooks to select and retreive data from and tooks aroung 20-25 minuts

    I get the result as i required but mainly looking for how i could speed up the process...

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Get data from closed workbook - ADO connection

    Patel's point is that if you use ADO, you don't open the workbook - so don't open it Opening large workbooks is slooow

    Edit: Actually having had a look at your code, I don't see where it does open the workbooks.
    Last edited by Kyle123; 06-10-2013 at 04:26 AM.

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Get data from closed workbook - ADO connection

    here
    Sub GetData_FCST_MERGE_DPRT_LEVEL()
         SaveDriveDir = CurDir
        'MyPath = Application.DefaultFilePath    'or use "C:\Data"
        'MyPath = "E:\CENTRAL LOGISTICS\2013\Consolidation All\Consolidation Productivity Report\Prod Report"
        MyPath = ThisWorkbook.Path & "\Reports"
        
        ChDrive MyPath
        ChDir MyPath
        FName = Application.GetOpenFilename(filefilter:="Excel Files,*.xl*", _
                                            MultiSelect:=True)

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Get data from closed workbook - ADO connection

    That doesn't open the file, it just gets the filename/s

  7. #7
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Get data from closed workbook - ADO connection

    My bad, you are right, I changed my post

  8. #8
    Registered User
    Join Date
    01-04-2011
    Location
    Kuwait
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Get data from closed workbook - ADO connection

    Its not actually opens the files,

    first its list the sheetnames from selcted workbook
    and then look through the each sheets and retreive the data.

    Thanks
    MM

  9. #9
    Registered User
    Join Date
    01-04-2011
    Location
    Kuwait
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Get data from closed workbook - ADO connection

    any one can assit please..

  10. #10
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Get data from closed workbook - ADO connection

    Your code seems correct, given that your report files have many sheets, you can try opening them instead of using ADO connection

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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