tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,194
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone,
I need to create a csv and in column D i need to preserve it as text or stop the leading zero from being removed?
Any ideas how i can do this?
I currently use this macro to save the document as a csv
This works great but I lose the leading zeros in column D
Coulmn D is set to text and the zeros are there until you close it down when the csv looses all formating.
please help if you can
Thanks
Tony
I need to create a csv and in column D i need to preserve it as text or stop the leading zero from being removed?
Any ideas how i can do this?
I currently use this macro to save the document as a csv
VBA Code:
Sub Create_CSV()
Application.ScreenUpdating = False
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim fName As String
fName = welcome.Range("D12") & "\" & welcome.Range("D14") & " Report - saved " & Format(Now, "dd-mmm-yyyy") & ".csv"
Output.Copy
ActiveWorkbook.SaveAs Filename:=fName, _
FileFormat:=xlCSVUTF8, CreateBackup:=False
' ActiveWorkbook.Close True
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Application.ScreenUpdating = True
End Sub
This works great but I lose the leading zeros in column D
Coulmn D is set to text and the zeros are there until you close it down when the csv looses all formating.
please help if you can
Thanks
Tony