View Full Version : Error 438 FileDialog Filters.Add
GalileoGali
11-28-2009, 08:18 AM
This is my code:
Sub test()
Dim dlg As FileDialog
Set dlg = Application.FileDialog(msoFileDialogFilePicker)
With dlg
.InitialFileName = "C:\"
.Title = "Choose the file."
.Filters.Clear .Filters.Add "Excel", "*.xls"
.Show
End With
End Sub
WHY I OBTAIN A ERROR 438 IN THIS LINE?
.Filters.Add "Excel", "*.xls"
Paul_Hossler
11-28-2009, 08:54 AM
If you really have these two statements on a single line ...
.Filters.Clear .Filters.Add "Excel", "*.xls"
... try making two lines.
Option Explicit
Sub test()
Dim dlg As FileDialog
Set dlg = Application.FileDialog(msoFileDialogFilePicker)
With dlg
.InitialFileName = "C:\"
.Title = "Choose the file."
.Filters.Clear
.Filters.Add "Excel", "*.xls"
.Show
End With
End Sub
This seems to work for me
Paul
GalileoGali
11-28-2009, 10:08 AM
Thanks.
NO, but it was just an edition error
lucas
11-28-2009, 10:22 AM
Are you trying to open a file browser that only shows excel files?
Paul's solution works for me too.
GalileoGali
11-28-2009, 05:40 PM
Thanks.
THE SAME CODE
In my version Excel 2007 >> OK
In my version Excel 2003 >> ERROR 438
In my version Excel 2000 >> FileDialog not exists
lucas
11-29-2009, 10:31 AM
I have 2003 and it works without error.....
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.