Forum Discussion
Cannot find Office.FileDialog
Hello. I am a volunteer writing an MS Access app for a charity. I need to open a file dialog box in the app to export / import table data. I cannot get VBA to recognize Office.FileDialog. When compiling the code, the compiler chokes on
Dim fDialog As Office.FileDialog
with the error message
Compile error:
User-defined type not defined
I'm using VBA for Applications 7.1.
I have Access 2019 MSO (16.0.13628.202340 64-bit
Which library has the FileDialog object? Is it Office 11.0 Object Library?
Should I be using a different object?
Thank you.
Arnold
- George_HepworthSilver Contributor
What will you do with it? Depending on your goal, there may be one or more options.
Look here for an example of opening a Windows dialog to search for a file, if that's what you need.
- ArnoldBrodyCopper Contributor
George_Hepworth I solved my problem by referencing the Microsoft Office 16.0 Object Library.
- Microsoft Office XX.X Object Library
Why not use late binding and then you don't need to set any references and use
https://www.devhut.net/2016/10/04/late-binding-the-filedialog/