VBA - run-time error '424' - object required - folderpicker


VBA - run-time error '424' - object required - folderpicker



I need to run a loop through all excel files in a folder and copy/paste the data from those files into a existing spreadsheet. To open the folder I'm using the 'msoFileDialogFolderPicker' from FileDialog applications. I've been troubleshooting the runTimeError '424' without success, & all research has led me to general info.
Any help would be greatly appreciated, & thanks in advance.



Here's the program:


Sub LoopAllExcelFilesInFolder()

Dim wb As Workbook
Dim myPath As String
Dim myFile As String
Dim myExtension As String
Dim FlrdPicker As FileDialog
Dim RowN As Long

Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual




'Retrieve target folder path from user

Set FlrdPicker = Appplication.FileDialog(msoFileDialogFolderPicker)

With FlrdPicker
.Title = "Select a Folder"
.AllowMultiSelect = False
.InitialFileName = Application.FilePath("E:IPICS-REFINED")
If .Show <> -1 Then GoTo NextCode
myPath = .SelectedItems(1) & ""
End With

NextCode:

myPath = myPath
myExtension = "*.xls*"
myFile = Dir(myPath & myExtension)

Do While myFile <> ""
Set wb = Workbooks.Open(Filename:=myPath & myFile)
DoEvents

'copy & paste data below last used row
Workbooks("IPIC-DATA.xlsx").Activate

RowN = Worksheets("Sheet1").Cells(Worksheets("Sheet1").Rows.Count, 1).End(xlUp).Row
RowN = RowN + 10
Worksheets("DIMENSIONAL").Range("K2").Copy
Worksheets("Sheet1").Range("A" & RowN).PasteSpecial
wb.Close SaveChanges:=True
DoEvents

myFile = Dir
Loop

MsgBox "Data Gathered!"

End Sub





Please include the code as text and not a picture.
– Scott Craner
Jul 2 at 20:30





but right off you have an extra p in Appplication.FileDialog
– Scott Craner
Jul 2 at 20:31


p


Appplication.FileDialog





How should we copy your picture into the VB Editor for testing? Do you have a tool for that?
– Ron Rosenfeld
Jul 2 at 20:31






Sorry for the mishap. I put the code in. You can reference the JPEG for indents.
– Kwon Black
Jul 2 at 20:41





Removed the extra 'p' and that resolved the '424'
– Kwon Black
Jul 2 at 20:45









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?