File Open dialog mystery (1 Viewer)

dkmoreland

Registered User.
Local time
Yesterday, 20:57
Joined
Dec 6, 2017
Messages
129
To facilitate the import of an Excel file, I am using a button on a form to open a Windows dialog to allow the user to select the file to import. Once they select the file and close that dialog, another button click actually does this import.

This all works great except on two particular computers. On these particular machines, the button click will not open the file dialog. There is no error message but the window does not open. If they manually type in the file name, the import works just fine. But, that file dialog will not open on these two computers.

Both of these machines are running Windows 10 with Office 365. They are laptops with external monitors connected and running an expanded desktop. Another oddity - another laptop with the exact same setup will open that file dialog just fine. And every other Windows/Office version combination we've got also works.

I've tried using Alt Tab to cycle through the open windows just to see if that file dialog is hiding anywhere but it is not open anywhere that I can see.

Is anybody aware of any Windows 10 / Office 365 issues that might cause such behavior?

Any and all advice, suggestions and wild guesses are welcome.

Thanks in advance!
:banghead:
 

isladogs

MVP / VIP
Local time
Today, 04:57
Joined
Jan 14, 2017
Messages
18,221
Are those two computers running 64-bit Access because the old File Open dialog only works in 32-bit. If so, I have replacement code I can upload

Suggest checking for missing references if that's not the case.
 

dkmoreland

Registered User.
Local time
Yesterday, 20:57
Joined
Dec 6, 2017
Messages
129
Are those two computers running 64-bit Access because the old File Open dialog only works in 32-bit. If so, I have replacement code I can upload

Suggest checking for missing references if that's not the case.

All the machines this is running on are 64-bit so that's not it. I'll look for missing references but there are not any error messages that point in that direction.
 

isladogs

MVP / VIP
Local time
Today, 04:57
Joined
Jan 14, 2017
Messages
18,221
All the machines this is running on are 64-bit so that's not it. I'll look for missing references but there are not any error messages that point in that direction.

Ah ... but are all running 64-bit Office which is the part that matters
 

dkmoreland

Registered User.
Local time
Yesterday, 20:57
Joined
Dec 6, 2017
Messages
129
Well - you were right. The ones that won't work are running 64-bit Access. So, if you would post that code you spoke of in your original post, I sure would appreciate it.

Thanks!
 

isladogs

MVP / VIP
Local time
Today, 04:57
Joined
Jan 14, 2017
Messages
18,221
Here you go.... IIRC no additional references are required
Make sure you include error handling as shown

Code:
Private Sub cmdBrowse_Click()
    
On Error GoTo Err_cmdBrowse_Click

[COLOR="SeaGreen"]'CR 28/08/2015 - Code rewritten to ensure compatibility with 64-bit Office[/COLOR]

[COLOR="SeaGreen"]' Set options for the dialog box.[/COLOR]
    Dim F As FileDialog
    Set F = Application.FileDialog(msoFileDialogFilePicker)
    F.Title = "Locate the file to be attached and click on 'Open'"
    F.AllowMultiSelect = False
    
[COLOR="seagreen"]' Clear out the current filters, and add our own[/COLOR]
    F.Filters.Clear
  [COLOR="SeaGreen"] 'modify the next line for your own purposes or omit for all files[/COLOR]
    F.Filters.Add "JSON files", "*.json"
    
[COLOR="seagreen"]' Set the start folder[/COLOR]
    F.InitialFileName = "c:\"
    
[COLOR="seagreen"]' Call the Open dialog routine.[/COLOR]
    F.Show

[COLOR="seagreen"]' Return the path and file name.[/COLOR]
    'strFileName = FindFilePath("C:\")
    strFileName = F.SelectedItems(1)

[COLOR="seagreen"]'Save the selected filename in a textbox    [/COLOR]
    Me.txtFile = strFileName

Exit_cmdBrowse_Click:
    Exit Sub

Err_cmdBrowse_Click:
   [COLOR="seagreen"] 'err=5, user clicked cancel[/COLOR]
    If Err.Number = 5 Then Exit Sub
        
    MsgBox "Error " & Err.Number & " in cmdBrowse_Click procedure : " & Err.Description
    Resume Exit_cmdBrowse_Click
    
End Sub
 

Users who are viewing this thread

Top Bottom