Hi all,
I had this code working great on my PC. When converting to mac, it will create the text file but fails at the "save-as". I have the newest excel for mac.
Can any give advice?
Here is the
I had this code working great on my PC. When converting to mac, it will create the text file but fails at the "save-as". I have the newest excel for mac.
Can any give advice?
Here is the
Rich (BB code):
Sub ExportCSV()
'
' ExportCSV Macro
Dim MyPath As String
Dim MyFileName As String
'The path and file names:
MyPath = ActiveWorkbook.Path & "\"
MyFileName = Worksheets("CustInfo Sheet").Range("B4").Value
If Not Right(MyPath, 1) = "\" Then MyPath = MyPath & "\"
'Makes sure the filename ends with ".txt"
If Not Right(MyFileName, 4) = ".txt" Then MyFileName = MyFileName & ".txt"
'Copies the sheet to a new workbook:
Sheets("CustInfo").Copy
'The new workbook becomes Activeworkbook:
With ActiveWorkbook
'Saves the new workbook to given folder / filename:
.SaveAs Filename:= _
MyPath & MyFileName, _
FileFormat:=xlTextPrinter, _
CreateBackup:=False
'Closes the file
.Close False
End With