GetSaveAsFilename

A

Anand Attavane

I can't make this method work. I want to save the file as
formatted text file, i.e., .prn file. Here is my code:

Sub GetUserSaveFile()
Dim PPF As Variant
PPF = Application.GetSaveAsFilename("Ckdate.prn",
Filefilter:="*.prn")
ThisWorkbook.SaveAs Filename:=PPF
End Sub

I get application "Runtime Error 1004"
Method 'GetSaveAsFilename' of object "_Application' failed.

Thank you for your help.
 
D

Dan E

Anand,

You've got your file filter property set baddly Try

PPF = Application.GetSaveAsFilename("Ckdate.prn", "Formatted Text, *.prn")

FileFormat:="Type description, extension"

Dan E
 
T

Tom Ogilvy

Your next problem will be with the file SaveAs command

Dim PPF as String
Chdrive "C"
Chdir "C:\My folder1\Mysubfolder"
PPF = Application.GetSaveAsFilename( _
InitialFileName:="ckdate.prn", _
FileFilter:="Formatted Text (*.prn), *.prn")
ActiveWorkbook.SaveAs _
FileName:=ppf, _
FileFormat:=xlTextPrinter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top