Problems using FileDialog Object

G

Guest

I am trying to use FileDialog to allow the client to select a valid folder. VBA seems to not recognize the object type, referring to it as "user-defined" when I try to DIM a varible with it

Alot of times, VBA will show you the valid objects and properties while you are typing in. FileDialog is not recognized as a valid part of Application. Below is the code I am attempting to use

Dim FolderSelector As FileDialo
Set FolderSelector = Application.FileDialog(msoFileDialogFolderPicker

Do I need to include a specific Refernce to allow FileDialog to be recognized as a valid object type

Ke
 
K

Ken Slovak - [MVP - Outlook]

What FileDialog object? Where does it come from? Anything that you
want intellisense for in VB/VBA must have a project reference set for
it.




Ken Edwards said:
I am trying to use FileDialog to allow the client to select a valid
folder. VBA seems to not recognize the object type, referring to it
as "user-defined" when I try to DIM a varible with it.
Alot of times, VBA will show you the valid objects and properties
while you are typing in. FileDialog is not recognized as a valid part
of Application. Below is the code I am attempting to use.
Dim FolderSelector As FileDialog
Set FolderSelector = Application.FileDialog(msoFileDialogFolderPicker)

Do I need to include a specific Refernce to allow FileDialog to be
recognized as a valid object type?
 
G

Guest

If you lookup filedialog in VBA Editor help, it is listed along with usage examples. But if you try to use it by the examples, you receive an error that it is a user defined object. It is almost as if you are told by Help that it is a valid object, but in practice, VBA does not know anything about it. I would assume that VBA would understand a filedialog object just as it would a msgbox object. Both are listed in the Help with examples. Both should already have the necessary references.

Ken

----- Ken Slovak - [MVP - Outlook] wrote: -----

What FileDialog object? Where does it come from? Anything that you
want intellisense for in VB/VBA must have a project reference set for
it.




Ken Edwards said:
I am trying to use FileDialog to allow the client to select a valid
folder. VBA seems to not recognize the object type, referring to it
as "user-defined" when I try to DIM a varible with it.while you are typing in. FileDialog is not recognized as a valid part
of Application. Below is the code I am attempting to use.
 
K

Ken Slovak - [MVP - Outlook]

The intellisense for Office.FileDialog works here. Do you have a
reference set in your VBA project for your version of Office in Tools,
References in your VBA project?




Ken Edwards said:
If you lookup filedialog in VBA Editor help, it is listed along with
usage examples. But if you try to use it by the examples, you receive
an error that it is a user defined object. It is almost as if you are
told by Help that it is a valid object, but in practice, VBA does not
know anything about it. I would assume that VBA would understand a
filedialog object just as it would a msgbox object. Both are listed
in the Help with examples. Both should already have the necessary
references.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top