msoFileDialogFilePicker Throws Error: object variable with block variable not set

arveearv

New Member
Joined
Apr 29, 2013
Messages
12
Office Version
  1. 2016
Platform
  1. Windows
  2. MacOS
Hi:

I'm trying to use this standard bit of code:

VBA Code:
Dim fd As Office.FileDialog
Dim strFile As String

Set fd = Application.FileDialog(msoFileDialogFilePicker)

With fd
    .AllowMultiSelect = False

    If .Show = -1 Then
        strFile = .SelectedItems(1)

    End If

End With

But I'm getting the error message:
object variable with block variable not set

Any idea what might be going wrong? [Note that when I am entering the code, "msoFileDialogFilePicker" does not pop up from the References Library. Is it possible my system is missing this operation? If so, how would I add it to my resources? I'm a newbie to VBA -- please be kind!]


Arv
 
Makes sense. Thanks so much, Fluff!

(I might just migrate this whole project to a PC and save the headache.) Thanks for finding the root of the problem.


Arv
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top