Excel macro CSV issue -
im using excel macro generates csv file data upload gmail contacts. when file uploaded gmail contacts, mobile number , work number come correctly persons name comes in notes box "first name: yash". im attaching sample csv file generated macro.
im using following macro generate csv's:
sub getcsv() application.screenupdating = false csvnewsheet dim myrange range dim numrows integer set myrange = activesheet.range("a:a") numrows = application.worksheetfunction.counta(myrange) range("e1").select activecell.formular1c1 = "first name" range("e2").select activecell.formular1c1 = "=concatenate(reports!r[5]c2,"" "",reports!r[5]c1)" range("e2").select selection.autofill destination:=range("e2:e" & numrows + 1) range("e2:e3").select columns("e:e").entirecolumn.autofit hide_format exporttocsv delsht application.screenupdating = true end sub sub hide_format() ' ' hides name & place columns , removed formatting ' ' columns("a:a").select selection.delete shift:=xltoleft selection.delete shift:=xltoleft columns("c:c").select selection.cut columns("a:a").select selection.insert shift:=xltoright range("a1").select range(selection, selection.end(xldown)).select range(selection, selection.end(xltoright)).select selection.borders(xldiagonaldown).linestyle = xlnone selection.borders(xldiagonalup).linestyle = xlnone selection.borders(xledgeleft).linestyle = xlnone selection.borders(xledgetop).linestyle = xlnone selection.borders(xledgebottom).linestyle = xlnone selection.borders(xledgeright).linestyle = xlnone selection.borders(xlinsidevertical).linestyle = xlnone selection.borders(xlinsidehorizontal).linestyle = xlnone selection.interior .pattern = xlnone .tintandshade = 0 .patterntintandshade = 0 end end sub sub csvnewsheet() dim myrange range dim numrows integer set myrange = worksheets("reports").range("a:a") numrows = application.worksheetfunction.counta(myrange) + 3 sheets.add.name = worksheets("reports").range("a2").value & "_csv" worksheets("reports").range("a6:d" & numrows).copy destination:=worksheets(worksheets("reports").range("a2").value & "_csv").range("a1") worksheets(worksheets("reports").range("a2").value & "_csv").columns("a:d").autofit end sub sub exporttocsv() dim mypath string dim myfilename string myfilename = worksheets("reports").range("a2").value & "_csv" if not right(myfilename, 4) = ".csv" myfilename = myfilename & ".csv" worksheets(worksheets("reports").range("a2").value & "_csv").copy application.filedialog(msofiledialogfolderpicker) .title = "select folder save csv" .allowmultiselect = false .initialfilename = "" '<~~ start folder path file picker. if .show <> -1 goto nextcode mypath = .selecteditems(1) & "\" end nextcode: activeworkbook .saveas filename:=mypath & myfilename, fileformat:=xlcsv, createbackup:=false .close false end end sub sub delsht() application.displayalerts = false sheets(worksheets("reports").range("a2").value & "_csv").delete application.displayalerts = true end sub
this macro generates new sheet data required changes , save csv , delete sheet.
i dont know im going wrong...but contact names dont come in gmail... ive tried various other methods still didnt work...
please help!
this how gmail suggests format of csv file.
-
this how have yours formatted.
you may have have formatted way gmail suggests.
Comments
Post a Comment