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
Post a Comment