Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how do i Save a file with the name i want and with CVS(Command Del

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default how do i Save a file with the name i want and with CVS(Command Del

Noe,

This does not check if the file exists in the specified location and assigns
a counter number as the file name. Anyhow, one way is below, so modify the
code as needed. I'm sure others will post code that will do what you want.

Best,

Matthew Herbert

Sub SaveWksAsCSV()
Dim Wks As Worksheet
Dim Wkb As Workbook
Dim strFPath As String
Dim intCnt As Integer

Application.ScreenUpdating = False
strFPath = "C:\Documents and Settings"

For Each Wks In ActiveWorkbook.Worksheets
Set Wkb = Workbooks.Add
With Wkb
Wks.Copy .Worksheets(1)
.Worksheets(1).Name = intCnt
.SaveAs strFPath & "\" & intCnt & ".csv", xlCSV
.Close False
End With
intCnt = intCnt + 1
Next Wks
End Sub


"Noe" wrote:

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv

  #3   Report Post  
Posted to microsoft.public.excel.programming
Noe Noe is offline
external usenet poster
 
Posts: 20
Default how do i Save a file with the name i want and with CVS(Command

Matthew Herbert,

These is great thank you so much for you time, I just have an aditional
question in the same macro can select from Colum A thru E and cut and past
and the new book and save.

"Matthew Herbert" wrote:

Noe,

This does not check if the file exists in the specified location and assigns
a counter number as the file name. Anyhow, one way is below, so modify the
code as needed. I'm sure others will post code that will do what you want.

Best,

Matthew Herbert

Sub SaveWksAsCSV()
Dim Wks As Worksheet
Dim Wkb As Workbook
Dim strFPath As String
Dim intCnt As Integer

Application.ScreenUpdating = False
strFPath = "C:\Documents and Settings"

For Each Wks In ActiveWorkbook.Worksheets
Set Wkb = Workbooks.Add
With Wkb
Wks.Copy .Worksheets(1)
.Worksheets(1).Name = intCnt
.SaveAs strFPath & "\" & intCnt & ".csv", xlCSV
.Close False
End With
intCnt = intCnt + 1
Next Wks
End Sub


"Noe" wrote:

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv

  #4   Report Post  
Posted to microsoft.public.excel.programming
Noe Noe is offline
external usenet poster
 
Posts: 20
Default how do i Save a file with the name i want and with CVS(Command

Matthew this is great, thank you so much.

"Matthew Herbert" wrote:

Noe,

This does not check if the file exists in the specified location and assigns
a counter number as the file name. Anyhow, one way is below, so modify the
code as needed. I'm sure others will post code that will do what you want.

Best,

Matthew Herbert

Sub SaveWksAsCSV()
Dim Wks As Worksheet
Dim Wkb As Workbook
Dim strFPath As String
Dim intCnt As Integer

Application.ScreenUpdating = False
strFPath = "C:\Documents and Settings"

For Each Wks In ActiveWorkbook.Worksheets
Set Wkb = Workbooks.Add
With Wkb
Wks.Copy .Worksheets(1)
.Worksheets(1).Name = intCnt
.SaveAs strFPath & "\" & intCnt & ".csv", xlCSV
.Close False
End With
intCnt = intCnt + 1
Next Wks
End Sub


"Noe" wrote:

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default how do i Save a file with the name i want and with CVS(Command

Noe,

Replace
Wks.Copy .Worksheets(1)
with
Wks.Columns("A:F").Copy .Worksheets(1).Range("A1")
in order to copy columns "A:F" from the worksheet into the new workbook.

Best,

Matt

"Noe" wrote:

Matthew Herbert,

These is great thank you so much for you time, I just have an aditional
question in the same macro can select from Colum A thru E and cut and past
and the new book and save.

"Matthew Herbert" wrote:

Noe,

This does not check if the file exists in the specified location and assigns
a counter number as the file name. Anyhow, one way is below, so modify the
code as needed. I'm sure others will post code that will do what you want.

Best,

Matthew Herbert

Sub SaveWksAsCSV()
Dim Wks As Worksheet
Dim Wkb As Workbook
Dim strFPath As String
Dim intCnt As Integer

Application.ScreenUpdating = False
strFPath = "C:\Documents and Settings"

For Each Wks In ActiveWorkbook.Worksheets
Set Wkb = Workbooks.Add
With Wkb
Wks.Copy .Worksheets(1)
.Worksheets(1).Name = intCnt
.SaveAs strFPath & "\" & intCnt & ".csv", xlCSV
.Close False
End With
intCnt = intCnt + 1
Next Wks
End Sub


"Noe" wrote:

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv

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
Can I disable the Save command for an Excel file? Frali Excel Discussion (Misc queries) 1 September 14th 07 08:43 PM
Save as new file command button EnGo Excel Programming 2 July 28th 06 02:55 PM
getting vba shell command to execute batch and save output to a file Mad Scientist Jr Excel Programming 2 April 28th 06 03:00 PM
can i save an existing .xls file as a .csv file using command line craigkan Excel Discussion (Misc queries) 2 February 18th 05 02:01 PM
Specify a default file name in VB when the Save / Save As command. SMAN Excel Programming 1 September 14th 04 12:23 PM


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

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

About Us

"It's about Microsoft Excel"