1

I'm experiencing a

runtime error '429'

while running this program mentioned below. I've searched a lot to get a solution, but I couldn't find one.

I've tried restarting the system, re-registering the excel application and registering scrrun.dll. Nothing works.

Here's the code

Sub getDataFromWbs()

Dim wb As Workbook, ws As Worksheet
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")

'This is where you put YOUR folder name
Set fldr = fso.GetFolder("C:\temp\")

'Next available Row on Master Workbook
y = ThisWorkbook.Sheets("sheet1").Cells(Rows.Count, 1).End(xlUp).Row + 1

'Loop through each file in that folder
For Each wbFile In fldr.Files
    
    'Make sure looping only through files ending in .xlsx (Excel files)
    If fso.GetExtensionName(wbFile.Name) = "xlsx" Then
      
      'Open current book
      Set wb = Workbooks.Open(wbFile.Path)
      
      'Loop through each sheet (ws)
      For Each ws In wb.Sheets
          'Last row in that sheet (ws)
          wsLR = ws.Cells(Rows.Count, 1).End(xlUp).Row
          
          'Loop through each record (row 2 through last row)
          For x = 2 To wsLR
            'Put column 1,2,3 and 4 of current sheet (ws) into row y of master sheet, then increase row y to next row
            ThisWorkbook.Sheets("sheet1").Cells(y, 1) = ws.Cells(x, 1) 'col 1
            ThisWorkbook.Sheets("sheet1").Cells(y, 2) = ws.Cells(x, 2) 'col 1
            ThisWorkbook.Sheets("sheet1").Cells(y, 3) = CDate(ws.Cells(x, 3)) 'col 1
            ThisWorkbook.Sheets("sheet1").Cells(y, 4) = ws.Cells(x, 4) 'col 1
            y = y + 1
          Next x
          
          
      Next ws
      
      'Close current book
      wb.Close
    End If

Next wbFile

End Sub
bbt
  • 11
  • 2
  • Have you tried early binding? – Super Symmetry Jul 15 '20 at 10:48
  • Does this answer your question? [CreateObject("Scripting.FileSystemObject") doesn't work under Excel for Mac](https://stackoverflow.com/questions/23448686/createobjectscripting-filesystemobject-doesnt-work-under-excel-for-mac) – braX Jul 15 '20 at 10:53

0 Answers0