vba - VB: create comma separated string from array -
i trying convert list of array values comma separated string, single quotes.
my array name is:
info.arr_fonts( (0)times (1)verdana (2)arial (3)tahoma (4)helvetica ) - values dynamic, can +/-. enter code here
i write them string variable like:
"times, verdana, arial, tahoma, helvetica"
can show me how can done? tried simple like:
dim strfonts string strfonts = join(info.fontarray, ",")
but not add single quotes around each word.
update
dim arrfontnames variant dim strfonts string dim lctr long arrfontnames = array("doremi", "times-roman", "helvetica", "jivetalk", "jive") strfonts = join(arrfontnames, ",")
content of strfonts:
"doremi,times-roman,helvetica,jivetalk,jive"
i need pass strfonts parameter stored procedure. stored procedure needs receive lie this:
'doremi,times-roman,helvetica,jivetalk,jive'
will double quotes vba convert single quotes once executes stored procedure, or need string manipulation still?
add quotes loop.
sub test() dim lctr long lctr = lbound(info.fontarray) ubound(info.fontarray) info.fontarray(lctr) = "'" & info.fontarray(lctr) & "'" next strfonts = join(info.fontarray, ",") end sub
as per edit question. single param in stored proc need strfonts = "'" & join(info.fontarray, ",") & "'"
Comments
Post a Comment