Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Save file without prompting in Excel Macro

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Save file without prompting in Excel Macro

GetSaveAsFilename not save the file it only let you enter the file name.

You must copy the sheet to a new workbook and save that workbook with the value of A1

Try this for the activesheet

Sub ActiveSheet_CSV_File()
Dim wb As Workbook
Dim Fname As String
Fname = ThisWorkbook.Path & "\" & Range("A1").Value & ".csv"
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs Fname, FileFormat:=xlCSV
.Close False
End With
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



wrote in message ups.com...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Macro Save CSV Cell without Prompting [email protected] Excel Discussion (Misc queries) 1 November 16th 06 03:59 PM
Close Excel file without prompting user to save JDay01 Excel Programming 8 May 10th 05 09:14 PM
Prompting 'Save As' in an Excel Macro Glenn Gooding Excel Programming 1 December 2nd 04 09:49 AM
Save CSV File without prompting Chris Excel Programming 3 September 23rd 04 04:33 PM
Save file without prompting andym Excel Programming 1 February 20th 04 02:11 PM


All times are GMT +1. The time now is 06:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"