11 Replies Latest reply: Jul 31, 2014 5:22 PM by Layne Buck RSS

    Open all wokbooks from folder with macro

    Andres Quinteiro

      Hello everybody! I have this macro in VB, but I want open all workbooks that are in this folder, but I dont know how will be the names of all workbooks. I tried this but it doesn't work..

       

      FUNCTION ConvertirFormatoArchivos()

        Dim  file, origen
        Set objExcel = CreateObject("Excel.Application")

        set file = CreateObject("Scripting.FileSystemObject")

       

               CurrentDirectory = path.GetAbsolutePathName(".")

               origen = CurrentDirectory & "\Bajadas\"  

               file  = origen & "*.xlsb"

       

                While (file <> "")

                

                     objExcel.Workbooks.Open(file)

                     file = origen & "*.xlsb" 'Tomo todos los archivos binarios de la carpeta \Bajadas

               Wend 

      END FUNCTION

       

      Thank you!!