Macro for save as

D

deeds

I have a macro with this at the end...

Application.Dialogs(xlDialogSaveAs).Show

however, I want the "save as type" at the bottom of the "Save as box" to
default to .txt

Thanks in advance...
 
D

dbKemp

I have a macro with this at the end...

Application.Dialogs(xlDialogSaveAs).Show

however, I want the "save as type" at the bottom of the "Save as box" to
default to .txt

Thanks in advance...

Look at the Application.GetSaveAsFilename function. You can set
several parameters. The short side is that this only returns the
filename and does not acturally save the file. You would have to use
something like Scripting.TextStream (in Microsoft Scripting Runtime)
 
D

Dave Peterson

Application.Dialogs(xlDialogSaveAs).Show arg2:=xlTextWindows

There are lots of text files:
xltextmac
xltextmsdos
xltextprinter
xltextwindows
xlunicodetext

xlcsv
xlcsvmac
xlcsvmsdos
xlcsvwindows

ps. The parms for that SaveAs dialog are:

xlDialogSaveAs document_text, type_num,
prot_pwd, backup, write_res_pwd, read_only_rec

(taken from VBA's help for dialogs)

The constants came from VBA's help for xlfileformat/Microsoft Excel Constants.
 

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