excel vba - VBA Print .SelectedItem with MsgBox -


i trying print selected filename debugging purposes using simple msgbox. msofiledialogopen allows user select file. trying print file name of selected file.

'   start file explorer select file containing data dim lngcount long ' open file dialog application.filedialog(msofiledialogopen)     .allowmultiselect = true     .show  '   display paths of each file selected     lngcount = 1 .selecteditems.count         msgbox .selecteditems     next lngcount end 

when run error message "run-time error '450': wrong number of arguments or invalid property assignment".

looks message box trying show whole collection (.selecteditems) rather 1 @ time (.selecteditems(lngcount)). work if put this?

for lngcount = 1 .selecteditems.count     msgbox .selecteditems(lngcount) next lngcount 

or simpler, might work, too:

for each filename in .selecteditems     msgbox filename next 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -