I
I
iminby2018-02-09 18:11:03
Macros
iminby, 2018-02-09 18:11:03

Does anyone have or what to add to this ready-made macro in order to save in this CSV format?


Name,"Base Price",Categories,Images,"Attribute Name 1","Attribute Value(s) 1","Attribute Visibility 1","Global Attribute 1","Attribute Name 2"," Attribute(s) Value(s) 2","Attribute Visibility 2","Global Attribute 2","Attribute Name 3","Attribute(s) Value(s) 3","Attribute Visibility 3" ,"Global attribute 3"

We want text fields with more than one word to keep " ".
There is such a macro, but it sets everything to " ":
Sub SaveAsCSVinQuotes()   
Dim r As Range, c As Range, s As String   
s = Application.GetSaveAsFilename(, "CSV Files (*.csv),*.csv,All Files (*.*),*.*", , "Сохранение в формате CSV в кавычках")   
If s = "False" Then Exit Sub   
Open s For Output As #1   
For Each r In ActiveSheet.UsedRange.Rows   
   s = ""   
   For Each c In r.Cells   
       s = s & ";" & """" & c & """"   
   Next   
   Print #1, Mid$(s, 2)   
Next   
Close #1   
End Sub

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question