View Single Post
  #6 (permalink)  
Old August 1st, 2006, 03:04 PM
KALOR55 KALOR55 is offline
Authorized User
 
Join Date: Jul 2006
Location: , , Poland.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default


I have the next solution (I think that it is better)
Please read comments
Sub KOPIA1()
    Dim NAME_OF_SHEET As String
    NAME_OF_SHEET = Application.ActiveSheet.Name ' name of sheet which will be saved as .csv
    Workbooks.Add
    ActiveWorkbook.SaveAs ("C:\Documents and Settings\KAZIKL\Pulpit\" & NAME_OF_SHEET & ".xls") ' C:\Documents and Settings\KAZIKL\Pulpit\ path to temporary .xls file (You should change this patch)
    Windows("KAZIK1.xls").Activate ' here put name of your file
    Sheets(NAME_OF_SHEET).Select
    Sheets(NAME_OF_SHEET).Copy Before:=Workbooks(NAME_OF_SHEET & ".xls").Sheets(1)
    Sheets(Array("Arkusz1", "Arkusz2", "Arkusz3")).Select ' in English Sheet1, Sheet2 and Sheet3
    Application.DisplayAlerts = False
    ActiveWindow.SelectedSheets.Delete
    ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\KAZIKL\Pulpit\" & NAME_OF_SHEET & ".csv", FileFormat:=xlCSV 'C:\Documents and Settings\KAZIKL\Pulpit\ path to .csv file (You should change this patch)
    ActiveWorkbook.Save
    ActiveWindow.Close
    Windows("KAZIK1.xls").Activate
    Kill ("C:\Documents and Settings\KAZIKL\Pulpit\" & NAME_OF_SHEET & ".xls") 'C:\Documents and Settings\KAZIKL\Pulpit\ path to temporary .xls file (You should change this patch)
    Application.DisplayAlerts = True
End Sub

Reply With Quote