excel vba - VBA Code to set the file path dynamically -
i have vba code read xml below
strtargetfile = "c:\users\xxxxxx\desktop\xxxxxx\xxxx\xml\details.xml" set wb = workbooks.openxml(filename:=strtargetfile, loadoption:=xlxmlloadimporttolist)
is there way remove hardcoding ??
if have xml folder in same folder workbook folder try this:
sparentfolder = left(thisworkbook.path, instrrev(thisworkbook.path, "\") - 1) strtargetfile = sparentfolder & "\xml\details.xml" set wb = workbooks.openxml(filename:=strtargetfile,loadoption:=xlxmlloadimporttolist)
Comments
Post a Comment