I need to select a graphic file.
How can I create a file dialog box that lets me navigate folders, and when I click on a file shows a preview of the graphic?
make a reference to the Microsoft Scripting Runtime and use the FileSystemObject to navigate the file structure yourself. Set up a few listboxes and bob's ya uncle. A picture box can hold the preview!
hth
steve
The standard Windows File Open/Save dialog box, I think, should give that through clicking the view button and selecting preview. Here's a handy wrapper for that Call the standard Windows File Open/Save dialog box, but I'm not sure how to get it in "preview mode" programatically.
If you're using 2002 or higher versions, you should be able to use the FileDialog, for instance like this:
[tt]
dim dlg as filedialog
dim varFile as variant
set dlg = application.filedialog(msoFileDialogFilePicker)
with dlg
.initialview = msoFileDialogViewPreview
.filters.add "Piccies", "*.bmp;*.jpg;*.gif;*.ico;*.wmf", 1
if .show then
for each varFile in .selecteditems
msgbox varFile
next varFile
end if
end with
set dlg = nothing[/tt]
You will need a reference to the Microsoft Office Object library to use this (in VBE - Tools | References)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.