vba - Run-time error '1004' Method 'Worksheets' of object'_Global' failed -


i believe have unqualified reference issue code below, based on i've read. think need reference workbook i've tried number of ways of doing this, unsuccessfully. able assist?

dim f filedialog, str string set f = application.filedialog(msofiledialogfilepicker) f.show str = f.selecteditems(1)  dim xl excel.application set xl = new excel.application xl.visible = true xl.workbooks.open (str)  dim wst worksheet, wsa worksheet, wse worksheet, wsi   worksheet, lr long, lrow long  worksheets.add(after:=worksheets(1)).name = "table"  set wsa = worksheets("active") set wst = worksheets("table") 

one example, of i've tried

set wb = xl.workbooks.open(str) 

thank you!

you there. define variables first.

dim xl excel.application set xl = new excel.application xl.visible = true  dim xlwb excel.workbook '** added line set xlwb = xl.workbooks.open(str) 

rest of code looks @ first glance


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -