|
-
Jun 16th, 2013, 01:46 AM
#1
Thread Starter
New Member
[RESOLVED] [Excel] Having problems with .InitialFileName view with FileDialog command
So I am using the FileDialog to select a folder full of images that I am putting into a PowerPoint presentation and I am having problems getting the right initial view to come up.
Here is what I have
strFolder = InitDir
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
.AllowMultiSelect = False
.ButtonName = "Select"
.InitialView = msoFileDialogViewList
.InitialFileName = "C:\Users\Daniel\My Pictures\" 'using to test code
If Right(strName, 1) <> "\" Then
strFolder = strFolder & "\"
End If
If .Show <> -1 Then
Exit Sub
Else
strFolder = .SelectedItems(1) & "\"
End If
End With
If I exlude the "\" after "My Pictures", all the folders in my user folder "Daniel" comes up in the initial view with "My Pictures" initially selected, but when I include the "\" after, what I presume is the "FileDialogViewList" just shows up. How do I get the "My Pictures" folder to come up initially.
-
Jun 16th, 2013, 04:49 AM
#2
Re: [Excel] Having problems with .InitialFileName view with FileDialog command
all the folders in my user folder "Daniel" comes up in the initial view
do you have folders in "My Pictures"?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jun 16th, 2013, 04:55 AM
#3
Thread Starter
New Member
Re: [Excel] Having problems with .InitialFileName view with FileDialog command
Yes I do have folders in "My Pictures". I have also tried to go farther into the path to include one of the folders in "My Pictures" and one of the files in that folder, but run into the same problem. Whenever I was working on this at work I ran into the same problem. It's like it will only allow you to set the initialfilename at two folders into the drive if that makes sense. Like C:\1\2\ but not C:\1\2\3 or more. Is this just a limitation of using FileDialog or is there something I am missing.
Last edited by ddiaz; Jun 16th, 2013 at 05:11 AM.
Reason: To be more clear
-
Jun 17th, 2013, 11:48 PM
#4
Thread Starter
New Member
Re: [Excel] Having problems with .InitialFileName view with FileDialog command
I figured it out after I checked the properties of one of my folders in "My Pictures". The actual filepath used just "Pictures" instead of "My Pictures" as it shows Windows Explorer. Sneaky sneaky windows 7.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|