kualjo
07-31-2014, 09:01 AM
I have the following code that allows me to select a file. Once I have selected it, however, and click Open, I get Run-time Error 424 (Object required).
...
1 Dim csv_file As Excel.Workbook
2 Dim prq_file As Excel.Workbook
3
4 Set prq_file = ActiveWorkbook
5
6 Set csv_file = Application.GetOpenFilename("All files, *.csv")
7 If csv_file = False Then
8 Exit Sub
9 End If
...
I then tried changing line 6 to a With block, but then got a 91 error.
...
6 With Application
7 csv_file = .GetOpenFilename("All files, *.csv")
8 End With
...
Can someone please tell me what I'm missing? How can I rewrite this to get the file to open upon selection? Thank you.
...
1 Dim csv_file As Excel.Workbook
2 Dim prq_file As Excel.Workbook
3
4 Set prq_file = ActiveWorkbook
5
6 Set csv_file = Application.GetOpenFilename("All files, *.csv")
7 If csv_file = False Then
8 Exit Sub
9 End If
...
I then tried changing line 6 to a With block, but then got a 91 error.
...
6 With Application
7 csv_file = .GetOpenFilename("All files, *.csv")
8 End With
...
Can someone please tell me what I'm missing? How can I rewrite this to get the file to open upon selection? Thank you.