ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel Macro Save CSV Cell without Prompting (https://www.excelbanter.com/excel-discussion-misc-queries/119058-excel-macro-save-csv-cell-without-prompting.html)

[email protected]

Excel Macro Save CSV Cell without Prompting
 
I'm trying to save the file name of the imported CSV I modify with a
macro with the name of cell at $a1. No matter what I do it keeps
prompting me for a file name. Since I want to automate this macro I
don't want to be prompted at all. What am I missing?

Main Document = Master.xls
Imports = data.csv
Save as = whatever text is in A1 without prompting me in the same
directory
Close excel

Range("A1").Select
Application.DisplayAlerts = False
FName = Application.GetSaveAsFilename(Sheets("data").Range ("A1").Value,
fileFilter:="CSV Files (*.csv), *.csv")
Application.DisplayAlerts = True
ActiveWindow.Close
End Sub


[email protected]

Excel Macro Save CSV Cell without Prompting
 
Figured it out..

Range("A1").Select
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs _
Filename:=(Sheets("data").Range("A1").Value), _
FileFormat:=xlCSV, CreateBackup:=False
Application.DisplayAlerts = False
ActiveWindow.Close




wrote:
I'm trying to save the file name of the imported CSV I modify with a
macro with the name of cell at $a1. No matter what I do it keeps
prompting me for a file name. Since I want to automate this macro I
don't want to be prompted at all. What am I missing?

Main Document = Master.xls
Imports = data.csv
Save as = whatever text is in A1 without prompting me in the same
directory
Close excel

Range("A1").Select
Application.DisplayAlerts = False
FName = Application.GetSaveAsFilename(Sheets("data").Range ("A1").Value,
fileFilter:="CSV Files (*.csv), *.csv")
Application.DisplayAlerts = True
ActiveWindow.Close
End Sub




All times are GMT +1. The time now is 02:23 PM.

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