View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Run-time error €˜13 mismatch type

Hi,

I am not sure that you are on the right track for what you are trying to
achieve. I have given examples of 2 methods you might like to try.

You would normally only have one file filter and that is the one that you
want the user to use for the save. Something like the following adapted from
xl help.

Sub testFileSaveAs()
Dim fileSaveName

fileSaveName = Application.GetSaveAsFilename _
(fileFilter:= _
"Text Files (*.txt), *.txt", _
InitialFileName:="Test Save As")

If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
Else
MsgBox "User cancelled without saving."
End If
End Sub

If you want the SaveAs dialog box to allow the user to select the file type
then try the following code.

Sub testFileSaveAs1()

Dim diaSaveAs As Dialog

Set diaSaveAs = Application.Dialogs(xlDialogSaveAs)

With diaSaveAs
If .Show Then
MsgBox "File saved as filename: " _
& ThisWorkbook.Name
Else
MsgBox "User cancelled without saving"
End If
End With

End Sub

Hope this helps.

--
Regards,

OssieMac