How to apply the property "InitialView = msoFileDialogViewList"?


A

avkokin

Hello.
There is the code which opens dialog box (below).
Why I can't apply the property "InitialView = msoFileDialogViewList"
for dialog box? Let that primary the dialog had the initial
presentation as "msoFileDialogViewProperties". But after start this
macro the initial presentation don't change. Why?

Sub openDlg()
Dim fd As FileDialog
Dim regPath As String
Dim myPath As String
Dim keyValue As String
Set fd = Application.FileDialog(msoFileDialogOpen)
regPath = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common
\General"
keyValue = System.PrivateProfileString("", regPath, "RecentFiles")
myPath = Environ("APPDATA") & "\Microsoft\Office\" & keyValue & "\"
With fd
.InitialFileName = myPath
.AllowMultiSelect = False
.Filters.Add "Documents Word:", "*.doc; *.rtf; *.dot; *.docx"
.FilterIndex = 9
.Title = keyValue
.InitialView = msoFileDialogViewList 'here is problem ???
If .Show = -1 Then
.Execute
End If
End With
Set fd = Nothing
End Sub
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top