excel - How to open file using Open File Dialog -


i've been searching on web solution on how open file using open file dialog in vbscript. can point me on right track?

my code below opens excel file wanted more dynamic in terms input file name can change , not hard coded.

set objexcel = createobject("excel.application") objexcel.displayalerts = 0 set objshell = wscript.createobject("wscript.shell") path = objshell.currentdirectory infilename = "inputfile.xlsx" infilepath = path + "\" + infilename  'open target workbook set objworkbook1 = objexcel.workbooks.open(infilepath, false, true) msgbox "reading data " & infilename & vbnewline, vbokonly + vbinformation, _        "reading data" 

when in doubt, read documentation.

set dialog = objexcel.filedialog(3) dialog.allowmultiselect = true dialog.show  each f in dialog.selecteditems   set objworkbook = objexcel.workbooks.open(f)   '... stuff ...   objworkbook.close next 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -