I have two file extensions enabled with my program, .xls, & .txt. I also enabled all files. I have SaveFileDialog in a .bas file that I call from several procedures through out my program. What I need now is a way to change what shows in the "Save As Type" dialog box, depending on what code I procedure I call it from.

For example one procedure needs "Text Files" to show up a default, the other procedure requires "Excel Files" to show up as default.

'Code I use to call SaveFileDialog
Dim strFileName As String
strFileName = ShowSave(hwnd)

'-----------------------------------------------
'SaveFileDialog Code
'-----------------------------------------------
Option Explicit

Public Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Declare Function GetSaveFileName Lib "comdlg32.dll" Alias _
"GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
Public Function ShowSave(hwnd As Long) As String

Dim ofn As OPENFILENAME
Dim lngRetVal As Long

ofn.lStructSize = Len(ofn)
ofn.hwndOwner = hwnd
ofn.hInstance = App.hInstance
ofn.lpstrFilter = "All Files (*.*)" & Chr(0) & "*.*" & Chr(0) _
& "Microsoft Excel Workbook (*.xls)" + Chr$(0) + "*.xls" + Chr$(0) _
& "Text Files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0)
ofn.lpstrFile = Space$(254)
ofn.lpstrDefExt = "ext"
ofn.nMaxFile = 255
ofn.lpstrFileTitle = Space$(254)
ofn.nMaxFileTitle = 255
ofn.lpstrInitialDir = "C:\"
ofn.lpstrTitle = "Save As"
ofn.flags = 0
lngRetVal = GetSaveFileName(ofn)

If lngRetVal Then
ShowSave = ofn.lpstrFile
End If

End Function