Hi all,
I have a macro where i'm trying to convert an excel file to csv with semi-colon separator.
I thought the method was to convert to csv, and secondly to replace coma by semi-colon but it's not working.
It seems we can force the separator somehow, but I don't know how to do it inside my (already painful) code. below is mine :
how to include the trick in my code?
thanks for ideas
I have a macro where i'm trying to convert an excel file to csv with semi-colon separator.
I thought the method was to convert to csv, and secondly to replace coma by semi-colon but it's not working.
It seems we can force the separator somehow, but I don't know how to do it inside my (already painful) code. below is mine :
Code:
'variables
Dim CompanyCode As String
Dim Period As String
Dim Chemin_INF As String
Dim Nom_INF As String
Sub Data_Selection_INF()
Sheets("INF").Select
CompanyCode = Worksheets("INF").Range("A3")
Period = Worksheets("INF").Range("C3")
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Select
ActiveSheet.Paste
End Sub
Sub Export_csv_INF()
ActiveSheet.Select
Dim objSaveBox As FileDialog
Set objSaveBox = Application.FileDialog(msoFileDialogSaveAs)
With objSaveBox
.InitialFileName = CompanyCode & "_INF_" & Period & ".csv"
.FilterIndex = 15
.Show
.Execute
End With
Nom_INF = ActiveWorkbook.Name
Chemin_INF = ActiveWorkbook.Path
ActiveWorkbook.Close (Savechanges = False)
End Sub
Sub Compilation()
Data_Selection_INF
Export_csv_INF
MsgBox "File saved in the directory."
End Sub
thanks for ideas