VBA excel for existence of image format of type jpg -
lets have spreadsheet in excel named test.xls , inside column named column1 values image1, image2, etc. , have folder named images, contain images of type jpg, named values in column image1.jpg, image2.jpg, etc. need vba code check if images exist in folder based on spreadsheet column. thank you!
this example display search results in column. edit variables , don't forget last \ in folder path.
sub checkfiles() dim count&, lastrow& dim folderpath, columnread, columnwrite string folderpath = "c:\example\" columnread = "a" columnresults = "b" lastrow = thisworkbook.sheets(1).range(columnread & rows.count).end(xlup).row count = 1 lastrow range(columnread & count).activate if dir(folderpath & range(columnread & activecell.row).value) <> "" range(columnresults & activecell.row).value = "file exists." else range(columnresults & activecell.row).value = "file doesn't exist." end if next count end sub
Comments
Post a Comment