D
David
I am trying to create a .csv file from an Excel workbook
using a VB module and am wondering if someone can tell me
what's wrong with the below code:
Public Sub CSV2()
Application.DisplayAlerts = False
Sheets.Add
ActiveSheet.Name = "Temp_10001"
For Each ws In Worksheets
If ws.Name <> "Temp_10001" Then
ws.UsedRange.Copy
Sheets("Temp_10001").Range("A1").Activate
x = ActiveSheet.UsedRange.Rows.Count
If x > 1 Then ActiveCell.Offset(x, 0).Select
ActiveCell.PasteSpecial (xlPasteValues)
End If
Next
SaveName = Application.GetSaveAsFilename(, "CSV (Comma
delimited)(*.csv), *.csv")
ActiveWorkbook.SaveAs Filename:=SaveName,
FileFormat:=xlCSV
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub
It runs fine until it gets to:
SaveName = Application.GetSaveAsFilename(, "CSV (Comma
delimited)(*.csv), *.csv")
Thank you so much.
using a VB module and am wondering if someone can tell me
what's wrong with the below code:
Public Sub CSV2()
Application.DisplayAlerts = False
Sheets.Add
ActiveSheet.Name = "Temp_10001"
For Each ws In Worksheets
If ws.Name <> "Temp_10001" Then
ws.UsedRange.Copy
Sheets("Temp_10001").Range("A1").Activate
x = ActiveSheet.UsedRange.Rows.Count
If x > 1 Then ActiveCell.Offset(x, 0).Select
ActiveCell.PasteSpecial (xlPasteValues)
End If
Next
SaveName = Application.GetSaveAsFilename(, "CSV (Comma
delimited)(*.csv), *.csv")
ActiveWorkbook.SaveAs Filename:=SaveName,
FileFormat:=xlCSV
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub
It runs fine until it gets to:
SaveName = Application.GetSaveAsFilename(, "CSV (Comma
delimited)(*.csv), *.csv")
Thank you so much.