excel 2007 vba add item sheet names to listbox -
using excel 2007 vba
have sheet "dashboard", have other sheets special task sheets can anywhere in book, found between sheets "tasknew" , "taskend". these special task sheets vary in count.
upon dashboard activation, want populate listbox names of special task sheets, user can select sheet form drop down , navigate sheet.
following results in runtime error '438' object doesn't support property or method:
application.calculation = xlcalculationautomatic application.screenupdating = true dim startindex integer dim endindex integer dim loopindex integer 'dim sht worksheet startindex = sheets("tasknew").index + 1 endindex = sheets("taskend").index - 1 loopindex = startindex endindex 'sheetsnavigationdropdown.additem sheets(loopindex).name 'sheets("dashboard").listbox20.additem sheets("sample").name sheets("dashboard").listbox20.additem sheets(loopindex).name next loopindex
i have tried listbox20.additem ... still doesn't work. yes, listbox20 exists on sheets("dashboard"), yes edited it's name eliminate spaces.
it chokes on/highlights sheets("dashboard").list.... line when debugging.
ideas?
might start sanity check:
dim o oleobject debug.print "---" each o in sheets("dashboard").oleobjects debug.print o.name & " = " & o.progid next o debug.print "---"
and should listbox20 = forms.listbox.1
1 of results
(edit: works in excel 2003 anyway)
Comments
Post a Comment