View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] wildatom@hotmail.com is offline
external usenet poster
 
Posts: 4
Default Save file without prompting in Excel Macro

I'm trying to save the file name of the imported CSV with the name of
cell at A1. No matter what I do it keeps
prompting me for a file name, however the prompt correctly displays the
name in cell A1.

Since I want to automate this macro I
don't want to be prompted at all.

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