Wise Owl Answers - How do I get data from multiple workbooks with one query in VBA?

Поделиться
HTML-код
  • Опубликовано: 24 янв 2025

Комментарии • 47

  • @tejamarneni
    @tejamarneni 3 года назад +6

    I love it when RUclips sends notification about your video. Awesome video as usual. I wish more people would know about your channel. I recommended your videos to my friends and colleagues and continue to do so.

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад +2

      Thank you Ravi! Your support and recommendations are very much appreciated!

  • @youssefsedkey7616
    @youssefsedkey7616 3 года назад +1

    Full explanation in utmost magnificence.

  • @janezklun
    @janezklun 3 года назад +1

    Great, interesting video, the best on YT, thank you Andrew

  • @krn14242
    @krn14242 3 года назад +1

    Great Andrew... Got some good ideas and tried my own example.. It worked thanks to you...

  • @KhalilYasser
    @KhalilYasser 3 года назад +2

    Amazing tutorials as usual. I am waiting for your videos daily.

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад +1

      Thank you Yasser, I'm happy that you're enjoying the recent videos!

  • @frikduplessis8849
    @frikduplessis8849 3 года назад +1

    👏👏👏👏👏👏👏👏 brilliant video Andrew, thank you again for a very clear explanation of a very interesting topic, I can't wait for the next one, God bless

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад

      Thank you Frik! It seems that this topic has been interesting for many people. I'm happy to hear that you're enjoying the videos and thank you for your support!

    • @shinrafahell
      @shinrafahell 3 года назад +1

      Is it possible to INNER JOIN using this technique?

    • @frikduplessis8849
      @frikduplessis8849 3 года назад

      @@shinrafahell HI Rafael Andrew did a brilliant tutorial on JOINTS, UNION'S and some other interesting tips and tricks in this series just browse down 👌

  • @HereForTheBrains
    @HereForTheBrains 3 года назад +1

    Super interesting as always. Many thanks for the video

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад +1

      You're very welcome and thanks, as ever, for the support!

  • @초록나무-k8v
    @초록나무-k8v Год назад +1

    👍Very good, great!!!! Thanks

  • @onurtunc9468
    @onurtunc9468 2 года назад +1

    Great, Thank You so Much

  • @khaledseghari1189
    @khaledseghari1189 3 года назад +1

    Thank you very much

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад

      You're very welcome Khaled, thank you for watching!

  • @hajajahirhussain6814
    @hajajahirhussain6814 3 года назад +1

    Hi.
    I tried this with 29 workbooks total rows around 400000 with no extra criteria just "Select * from sheet1$".
    But the time consumption is much longer than normal do while loop with Dir() function.
    The ADO query takes 1.29 seconds to complete the process.
    But the normal Do While loop takes only 30 seconds to complete the process.

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад +1

      Interesting, thanks for sharing your research!

  • @ericdunham8835
    @ericdunham8835 3 года назад +1

    Love all your videos. The timing of this one is perfect for a project I'm working on. One additional thing I need to do is to pass a known consistent password to open the different workbooks that are being connected to. I've been searching for the syntax to add the password to the ConnectionString. Do you have any recommendations for examples to reference? TIA!

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад

      Hi Eric! As far as I know it's not possible to include a password for an Excel workbook in a connection string using the ACE.OLEDB provider. The generally accepted workaround appears to be opening the workbook using either the Workbooks.Open method docs.microsoft.com/en-gb/office/vba/api/Excel.Workbooks.Open or the GetObject method (although this will prompt you for the password) www.connectionstrings.com/how-to-open-password-protected-excel-workbook/ and then use ADO to work with the opened file.
      Not ideal I appreciate, but I don't know of another method!

  • @walerij
    @walerij 3 года назад +1

    Thank you very much for these videos! Very good explained. A question: how can I detect which file the selected data serie is coming from? I have many many files and I suppose that some WHERE-condition is wrong, but I can`t find out where / which files returns the "wrong" data.

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад +1

      Hi Валерий!
      You can add a calculated column to the SELECT statement to include the name of the file like this:
      Do Until MovieFileName = ""

      If IsFirstFile Then
      SQLString = "SELECT [Sheet1$].*, '" & MovieFileName & "' AS [FileName] FROM [Sheet1$]"
      IsFirstFile = False
      Else
      SQLString = SQLString & " UNION ALL SELECT [Sheet1$].*, '" & MovieFileName & "' FROM [Sheet1$] IN '" & _
      MyFilesPath & MovieFileName & "' 'Excel 12.0 Xml;'"
      End If

      MovieFileName = Dir

      Loop
      I hope it helps!

    • @walerij
      @walerij 3 года назад +1

      @@WiseOwlTutorials Oh, thank you so much! I'll try this.

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад

      @@walerij No problem!

  • @luizhenriquedacostajardim5511
    @luizhenriquedacostajardim5511 3 года назад +1

    Hi,
    Thank you very much for the lessons. They are all excellent and have great content for use.
    I would like to know if you have already made a video that teaches you how to consult and extract texts (not tables) from files in PDF format.
    Thank you very much!
    Olá,
    Muito obrigado pelas lições. São todas excelentes e de grande conteúdo para utilização.
    Gostaria de saber se já fez algum vídeo que ensina a consultar e extrair textos (não tabelas) de arquivos em formato PDF.
    Muito obrigado!

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад

      Hi Luiz! You're very welcome for the videos, thank you for watching them.
      We don't have a video on extracting text from PDF files yet but this topic is on my list of videos to make.

    • @luizhenriquedacostajardim5511
      @luizhenriquedacostajardim5511 3 года назад +1

      @@WiseOwlTutorials Thank you very much.
      I'm sure it will be another excellent job.
      Success!
      Muito obrigado.
      Tenho certeza de que será outro excelente trabalho.
      Sucesso!

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад

      @@luizhenriquedacostajardim5511 Obrigado Luiz!

  • @UzmanExcel
    @UzmanExcel 3 года назад +1

    How to be make this code more dynamic such as collecting data from sheets which names are not like Sheet*
    Because, if i understand correctly this code does not work if sheet name is different from Sheet1, am i right?

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад +1

      Hi Uzman! If you combine the techniques shown in this video ruclips.net/video/5F8q7Z9kWGw/видео.html I think you'll be pleased with the results!
      I'll have another video tomorrow which covers similar ideas!

  • @jabinik5865
    @jabinik5865 11 месяцев назад

    Can you do joins from multkple workbooks?

    • @WiseOwlTutorials
      @WiseOwlTutorials  10 месяцев назад

      Yes! Check out part 58.22 in this playlist ruclips.net/p/PLNIs-AWhQzckUd5i0E1xeSFeBAonYIurK&feature=shared

  • @johnabram4159
    @johnabram4159 3 года назад

    Hi Andrew, I have a question too. Would appreciate if you can make a video on it.
    How to perform Mailmerge in MS Word with the selected record in Excel file. It is so easy to do manually but, could not figure out how to do it in Excel VBA. If possible, the Mailmerge also updates an image based on selected record. For example, picture of a student.

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад

      Thanks John, I'll pop that question on the to-do list!

  • @shaileshsharma668
    @shaileshsharma668 3 года назад

    Hello Sir ,
    Can you please help me how to link one Access database to another Access database using Excel VBA

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 года назад

      Hi Shaielsh! Yes, you can use the TransferDatabase method to do this. You can see some examples of the code you need here
      docs.microsoft.com/en-gb/office/vba/api/Access.DoCmd.TransferDatabase
      I hope that helps!

    • @shaileshsharma668
      @shaileshsharma668 3 года назад +1

      @@WiseOwlTutorials thansk sir

  • @timemanon2052
    @timemanon2052 2 года назад

    Thanks you for your greats vedio, l wish if you can make for us a vedio about adodb (ado) using late binding vba.

    • @WiseOwlTutorials
      @WiseOwlTutorials  2 года назад

      Hi! You can see how to use ADODB with late binding in the first 10 minutes of this video ruclips.net/video/HE9CIbetNnI/видео.html
      You might also find this useful ruclips.net/video/qmJPbub-D0E/видео.html
      I hope it helps!

    • @timemanon2052
      @timemanon2052 2 года назад

      Thank you Mester WISE for your help and for your amazing videos. Sorry to tell you that l have a problem when i try using creatobject function in your exemple code "Get data from a closed excel file" the code doesn't work.

  • @BachXuanHien
    @BachXuanHien 2 года назад