excel - How to do 'Save As' using VBA -
i ask helping code below. got when recorded macro upon saving new file desktop.
i having issues change directory line. changes happen every time different user using macro can depend on value of e
.
also, part of filename varies depends on value of d
.
please me improve codes. thanks!
dim b, c, d, e string b = msgbox("this file has saved. click ok.", vbokcancel, "save sharepoint") activeworkbook.save c = msgbox("save file local", vbokonly, "save local") d = inputbox("this shift record falls on week?", "save shift record", "yyyymmdd-yyyymmdd") e = inputbox("enter eid", "save shift record", "eid") 'this line give error ~~~~~ chdir "c:\users\ma.cristina.i.gumato\desktop" activeworkbook.saveas filename:= "c:\users\d\desktop\manila_shiftrecord_" + d + ".xlsx", fileformat:=xlopenxmlworkbook, createbackup:=false
does work you?
dim b, c, d, e string b = msgbox("this file has saved. click ok.", vbokcancel, "save sharepoint") activeworkbook.save c = msgbox("save file local", vbokonly, "save local") d = inputbox("this shift record falls on week?", "save shift record", "yyyymmdd-yyyymmdd") e = inputbox("enter eid", "save shift record", "eid") activeworkbook.saveas filename:= "c:\users\" & environ("username") & "\desktop\manila_shiftrecord_" + d + ".xlsx", fileformat:=xlopenxmlworkbook, createbackup:=false
Comments
Post a Comment