ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for save as (https://www.excelbanter.com/excel-programming/419184-macro-save.html)

Deeds

Macro for save as
 
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...

dbKemp

Macro for save as
 
On Oct 28, 5:18 pm, deeds wrote:
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)

Dave Peterson

Macro for save as
 
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 a

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.

deeds wrote:

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...


--

Dave Peterson


All times are GMT +1. The time now is 11:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com