Created
December 19, 2019 16:40
-
-
Save trbarron/2adb36b1360bca392a8611ca6c26db27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub csv() | |
Dim MyFileName As String | |
Dim CurrentWB As Workbook, TempWB As Workbook | |
Set CurrentWB = ActiveWorkbook | |
ActiveWorkbook.ActiveSheet.UsedRange.Copy | |
Set TempWB = Application.Workbooks.Add(1) | |
With TempWB.Sheets(1).Range("A1") | |
.PasteSpecial xlPasteValues | |
.PasteSpecial xlPasteFormats | |
End With | |
MyFileName = CurrentWB.Path & "\" & Left(CurrentWB.Name, Len(CurrentWB.Name) - 5) & ".csv" | |
Application.DisplayAlerts = False | |
TempWB.SaveAs Filename:=MyFileName, FileFormat:=xlCSV, CreateBackup:=False, Local:=True | |
TempWB.Close SaveChanges:=False | |
Application.DisplayAlerts = True | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment