Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getFileOpenName "versus" FileDialog

Status
Not open for further replies.

PeteR61

Technical User
Apr 29, 2006
4
NL
Hello,
This question is about opening a file with the file dialog window in powerpoint.

In excel using following code works great:
Code:
fileToOpen = Application _
    .GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen <> False Then
    MsgBox "Open " & fileToOpen
End If

In powerpoint it doesn't. It gives an error. Pitty since I want to pass a filter as well. Currently I use temporary code like this to get something going:
Code:
Set dlgOpen = Application.FileDialog(Type:=msoFileDialogOpen)
    'show the file open dialog
    With dlgOpen
        .AllowMultiSelect = False
        .InitialFileName = "*.swf"
        .Show
    End With
So I want a file filter on this one as well. But I do not know how to be able to put a "Files of Type" filter in here like in excel.

Thanks
 
An example of how to mod your code:
Code:
Set dlgOpen = Application.FileDialog(Type:=msoFileDialogOpen)
    'show the file open dialog
    With dlgOpen
         .Filters.Add "Images", "*.gif; *.jpg; *.jpeg", 1        .AllowMultiSelect = False
        .InitialFileName = "*.swf"
        .Show
    End With





[pc2]
 
That worked just the way I wanted.
My problem is solved.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top