excel - export data onto csv and rename after computer profile name -
i want exportdata excel file onto csv saved in folder s:\froyo\ics. want name csv file after computer profile name. im using below code im not getting naming part right.
sub csvfile()
dim fs object, object, integer, s string, t string, l string, mn string set fs = createobject("scripting.filesystemobject") suser = environ("username") set = fs.createtextfile("s:\froyo\ics\suser.csv", true) r = 1 range("a65536").end(xlup).row s = "" c = 1 while not isempty(cells(r, c)) s = s & cells(r, c) & "," c = c + 1 wend a.writeline s 'write line next r
end sub
the s user variable should concatenated string, otherwise, takes part of string , not variable:
set = fs.createtextfile("s:\froyo\ics\" & suser &".csv", true)
Comments
Post a Comment