Share via


Using Common Dialog From Within Access 2010 64 bit

Question

Wednesday, June 9, 2010 3:52 PM

GetOpenFileName does not work in VBA under the 64 bit version of Access 2010.

I want to use the CommonFileDialog to replace all the bits that don't work.

What reference do I need so that VBA recognises the Common Dialog types.

At present the statement

Dim cfd As CommonOpenFileDialog

results in a compiler error "User-defined type not defined"

 

All replies (8)

Thursday, June 10, 2010 9:18 PM ✅Answered

I actually much suggest using the built in File dialog.

 

It works with going back to 2007, and i think even perhaps 2003.

 

You don't need any additonal code, and thus for 64 or 32, it will run without issues. (and it even works in runtime only). It don't have any refferences issues either.

 

So, I see little need for api, or additional code with the built in filedialog.

 

CODE:

Dim f    As FileDialog

Set f = Application.FileDialog(msoFileDialogFilePicker)

f.Show

MsgBox "file choose was " & f.SelectedItems(1)

 

You can late bind if you wish:

 

If you remove the reference to the 14.0 object library, then the following

code will work without any references:

 

 

   Dim f    As Object

   Set f = Application.FileDialog(3)

   f.AllowMultiSelect = True

   f.Show

 

   MsgBox "file choosen = " & f.SelectedItems.Count

 

Note that above works in the runtime also...

 

Albert D. Kallal

Edmonton, Alberta Canada

 


Wednesday, June 9, 2010 4:00 PM

Hallo infrazee,

infrazee schrieb folgendes:

GetOpenFileName does not work in VBA under the 64 bit version of Access 2010.

I want to use the CommonFileDialog to replace all the bits that don't work.

What reference do I need so that VBA recognises the Common Dialog types.

At present the statement

Dim cfd As CommonOpenFileDialog

results in a compiler error "User-defined type not defined"

Download my Tools (for Office 32bit)
(http://www.avenius.de/en/index.php?Products:IDBE_Tools ) the generated
code is compatible to Office 2010 x64

http://www.avenius.de/en/index.php?Products:IDBE_Tools:File___Folder_Dialog_Wizard
HTH
Gunter

 

Access FAQ: http://www.donkarl.com

      http://www.avenius.com - http://www.AccessRibbon.com
http://www.ribboncreator.com - http://www.ribboncreator2010.com


Wednesday, June 9, 2010 5:50 PM

Dear Gunther,

After installing your tools, on which tab in VBA do I find them?

infrazee


Wednesday, June 9, 2010 6:13 PM

Hello infrazee:

infrazee wrote:

After installing your tools, on which tab in VBA do I find them?

Only Office 32 Bit!

See:
http://www.avenius.de/en/index.php?Products:IDBE_Tools:Toolbar

"The IDBE Tools are available on the context menu by a simple right
click anywhere in the code area."

HTH
Gunter

Access FAQ: http://www.donkarl.com

      http://www.avenius.com - http://www.AccessRibbon.com
http://www.ribboncreator.com - http://www.ribboncreator2010.com


Wednesday, June 9, 2010 6:57 PM

I am using Office 64 Bit which is why I did not find your tools.

Thank you,

Infrazee


Wednesday, June 9, 2010 7:06 PM

Hello infrazee:

infrazee wrote:

I am using Office 64 Bit which is why I did not find your tools.

Here is a German sample for a File/Folder Dialog (Access 2007/2010):
http://kpries.de/download/comdlgdemo_x32_x64.zip

It´s the same class module from my tools.

HTH
Gunter

Access FAQ: http://www.donkarl.com

      http://www.avenius.com - http://www.AccessRibbon.com
http://www.ribboncreator.com - http://www.ribboncreator2010.com


Friday, June 11, 2010 5:11 AM

Thank you. This is a much better solution for me.


Sunday, June 20, 2010 12:22 PM

Hello infrazee,

infrazee wrote:

I am using Office 64 Bit which is why I did not find your tools.

Update 06/20/2010:
A version for Office 2010x64 are available.

HTH
Gunter

Access FAQ: http://www.donkarl.com

      http://www.avenius.com - http://www.AccessRibbon.com
http://www.ribboncreator.com - http://www.ribboncreator2010.com