Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50068

Macro to create CSV - Problems with spanish regional format

$
0
0
Hi, i was wondering if maybe you can help me out. I've created a macro linked to a button in Excel to take certain info populated in a spreadsheet and export it to a CSV file. It works fine so far, the problem i have is that this CSV will be used to be uploaded onto a MySQL DB and when Users with a spanish format configuration run the macro and save the CSV file, it gets saved using semi-colon as the delimiter as in spanish comma is the decimal point. How can i work around this? I need the CSV to be created and saved using strictly "," as the delimiter and "." as the decimal point. Here's the code i've built into the macro to generate and save this CSV, if at all possible i need your help to built in something there that locks the format in which the CSV is saved, it doesnt matter if the user that created cannot open it, or it errors out when he/she does as i said, it will only be used to upload the info onto a DB. thanks in advanced for your help guys...

The C2 cell validation is used to make sure the user checked that certain info has been created in the correct format (which validates in Excel through formulas)

Sub CmdButton_Click()

With Range("c2")
If Not IsDate(.Value) Then
MsgBox "Por favor verifique validacion de CUILs"
Exit Sub
End If
End With

Dim strFileName As String

strFileName = Application.GetSaveAsFilename(filefilter:="Comma Seperated Values (*.csv), *.csv")
If strFileName <> "False" Then
Sheets("CSV").Copy
ActiveWorkbook.SaveAs strFileName, xlCSV

End If


End Sub

Viewing all articles
Browse latest Browse all 50068

Trending Articles