Open Dialog Initial View (1 Viewer)

Thales750

Formerly Jsanders
Local time
Today, 06:16
Joined
Dec 20, 2007
Messages
2,077
An idea why this is not working

Dim fDialog As Object


Set fDialog = Application.FileDialog(3)


fDialog.InitialView = msoFileDialogViewLargeIcons

I've tried a lot of variations. None seem to work.


Thanks
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:16
Joined
Feb 28, 2001
Messages
27,122
Might be good to know (a) what it DOES do and (b) if that includes an error, what it says.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:16
Joined
Oct 29, 2018
Messages
21,447
An idea why this is not working

Dim fDialog As Object


Set fDialog = Application.FileDialog(3)


fDialog.InitialView = msoFileDialogViewLargeIcons

I've tried a lot of variations. None seem to work.


Thanks
Hi. Did you try it this way too?
Code:
fDialog.InitialView = 6
 

Thales750

Formerly Jsanders
Local time
Today, 06:16
Joined
Dec 20, 2007
Messages
2,077
fDialog.InitialView.fDialog.msoFileDialogViewLargeIcons = True
No change and no error

fDialog.InitialView = 6
no change no error

fDialog.InitialView(6)
no change no error

fDialog.InitialView = fDialog.msoFileDialogViewLargeIcons
no change co error

fDialog.InitialView = .msoFileDialogViewLargeIcons
Invalid or unqualified reference (that was expected)

fDialog.InitialView = msoFileDialogViewLargeIcons
Variable not Defined (that was expected)

This guy:


Runs an Excel site and he said something about Excel getting stuck on a certain dialog open view setting.


So I tried restarting the database and also adding this code at the end

fDialog.InitialView.Close
fDialog.InitialView = Nothing 'no errors but didn't do anything either


This was his code, you already know what it did.

oFD.InitialView = msoFileDialogViewDetails

So next I found this:
[url]https://docs.microsoft.com/en-us/office/vba/api/office.filedialog.initialview

No Joy what so ever. I added the reference to Microsoft Office. Still no.
 
Last edited:

Thales750

Formerly Jsanders
Local time
Today, 06:16
Joined
Dec 20, 2007
Messages
2,077
Here's the deal.

The .InitialView Property must be the first in the list. Here is some code from Stack Overflow. I added the .InitialView to several place in the
"With Statement" and finally at the top. And it worked.

https://stackoverflow.com/questions/9476268/filedialog-doesnt-work

I restarted Access after every change. This is important if you don't have the force close code writen, but I was troubleshooting so I was trying a tight control group.


Code:
Private Sub cmdOpenDialog_Click()
Const msoFileDialogFilePicker As Long = 1
Dim objDialog As Object

Set objDialog = Application.FileDialog(msoFileDialogFilePicker)

With objDialog
    .InitialView = 6

    .AllowMultiSelect = False
    .Show
    If .SelectedItems.Count = 0 Then
        MsgBox "No file selected."
    Else
        Me.FileNameTextBox.Value = Dir(.SelectedItems(1))
    End If
End With
End Sub
 

Thales750

Formerly Jsanders
Local time
Today, 06:16
Joined
Dec 20, 2007
Messages
2,077
I lied.

These Properties seem to conflict.
Code:
   With fDialog
    
         .InitialView = 6
        .InitialFileName = "Z:\OneDrive\Attachments"

It needs a "Change Directory" execution after ".Show".
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 03:16
Joined
Oct 29, 2018
Messages
21,447
Here's the deal.

The .InitialView Property must be the first in the list. Here is some code from Stack Overflow. I added the .InitialView to several place in the
"With Statement" and finally at the top. And it worked.

https://stackoverflow.com/questions/9476268/filedialog-doesnt-work

I restarted Access after every change. This is important if you don't have the force close code writen, but I was troubleshooting so I was trying a tight control group.


Code:
Private Sub cmdOpenDialog_Click()
Const msoFileDialogFilePicker As Long = 1
Dim objDialog As Object

Set objDialog = Application.FileDialog(msoFileDialogFilePicker)

With objDialog
    .InitialView = 6

    .AllowMultiSelect = False
    .Show
    If .SelectedItems.Count = 0 Then
        MsgBox "No file selected."
    Else
        Me.FileNameTextBox.Value = Dir(.SelectedItems(1))
    End If
End With
End Sub
Hi. Thanks for the update. Glad to hear you got it sorted out. Good luck with your project.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:16
Joined
Oct 29, 2018
Messages
21,447
There is a Microsoft Bug.
It doesn't work, and it may not be able to work.
Hi. Do you mean even if you put it as the first one, like you said earlier? If so, you might try using the Feedback button to let MS know about it.
 

Thales750

Formerly Jsanders
Local time
Today, 06:16
Joined
Dec 20, 2007
Messages
2,077
I lied.

These Properties seem to conflict.
Code:
   With fDialog
    
         .InitialView = 6
        .InitialFileName = "Z:\OneDrive\Attachments"

It needs a "Change Directory" execution after ".Show".

Hey DB Guy. I tried all different ways. Then I called my friend Gina Whipp,she said the same things. "They don't play nice together"

I have a laptop with win 10 and Office 2016. I will try it there and let you know.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:16
Joined
Oct 29, 2018
Messages
21,447
Hey DB Guy. I tried all different ways. Then I called my friend Gina Whipp,she said the same things. "They don't play nice together"

I have a laptop with win 10 and Office 2016. I will try it there and let you know.
Sounds like I should be expecting an email from Gina to the MS Team about this. Please let us know how it goes with Win10 and Office 2016. Thanks for the update.
 

Thales750

Formerly Jsanders
Local time
Today, 06:16
Joined
Dec 20, 2007
Messages
2,077
Sounds like I should be expecting an email from Gina to the MS Team about this. Please let us know how it goes with Win10 and Office 2016. Thanks for the update.

I guessing not so much. Her thinking is no one needs it. For everyday Email, I would agree.

But, this is a text message processor, text messages contain a lot of pic attachments. The truth is, I'm moving on past this. User will just have to right click in the dialog box to see the thumb nails.

Thanks for trying to help.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:16
Joined
Oct 29, 2018
Messages
21,447
I guessing not so much. Her thinking is no one needs it. For everyday Email, I would agree.

But, this is a text message processor, text messages contain a lot of pic attachments. The truth is, I'm moving on past this. User will just have to right click in the dialog box to see the thumb nails.

Thanks for trying to help.
Interesting. I know Access can't do "everything," but it sure can do a whole lot. It's just frustrating when a problem wins. Good luck!
 

Users who are viewing this thread

Top Bottom