# VBA - Office.Filedialog doesn't work



## Scanerman (Oct 2, 2002)

Can somebody out there help me. 

I've written and tested an application that opens a .txt file, processes it in XL to re-order the columns and strip duplicates and saves it as .csv. All works fine on my system which has Microsoft Office 10.0 Object Library.

Problem is when I run it on nother machine which has Microsoft Office 9.0 Object Library I get an object undefined error at my definition line

Dim FileDlg as Office.FileDialog

I have checked that Microsoft Office 9.0 Object Library is ticked in the references dialog for the project.

Looking in more detail when I enter "Office." in my module and look in the pull down list FileDialog is not there.

So I need to look at either alternative code to allow the user to select the source data file, or a way to replace the existing FileDialog object on the older machine.

Any ideas anybody?


----------



## Scanerman (Oct 2, 2002)

OK after a bit of messing about I've found that the FileDialog object exists in MSO.dll (v10.0) but not in MSO9.dll.

I've been able to switch between MSO.dll and MSO9.dll on my system running Win2000, but on a system running Windows XP with Office 2000 it corrupts Office when I try and install MSO.dll (v10.0). Attempting to start Excel starts an install wizard asking for the installation disk.

I copied MSO.dll to the same folder as MSO9.dll then renamed MSO9.dll as MSO9.bak. I had to do a system restore to get Office to work again after that. With MSO9.dll still in place however the VBA project references re-set to v9.0 each time I closed the References dialog.

So I still need a way to use Office.Dialogs on a system that currently has the Microsoft Office 9.0 Object Library.

Can anybody help?


----------



## talstog (Jul 20, 2005)

Take a look to:

mvp-access.com/accessvbafaq/item.asp?pagina=44

it's in spannish, but there you have a zip file (at the very bottom) that contains a Class Module that acts as a FileDialog but it's written to be used on Office 97 (without the need of the 10 Object Library)
Remember to mark as reference
Microsoft Visual Basic for Applications Extensibility 5.x

AND IT WORKS!!  (I had the same problem few days ago 

The zip contains the module and an example.

Hope it helps.

BTW. I just sign to post the solution, but there is a filter that does'nt allow to newbies to post URL            . I hope you will be able to read the URL and that it will not be filtered


----------

