insert picture
I'm not sure I understand your question; however, if Pic$ is a 6-digit
number only, you can do this to find a single file (there could be more than
one) that has that filename...
FileNameAndExtension = Dir(Path$ & Pic$ & ".*")
If Len(FileName) 0 Then
ActiveSheet.Pictures.Insert(FileName).Select
The dot in the dot-asterisk (.*) that I added signifies an extension and the
asterisk says that extension can be anything. I'm assuming you don't have,
say, txt file in that directory with the same filename part, otherwise you
will have to filter them out using a loop of some kind.
--
Rick (MVP - Excel)
"sunilpatel" wrote in message
...
Hi how do you insert picture if you only know the filename not the
extention
Pic$ is a six digit code, but the file if it exists can be .bmp, .gif,
.jpeg , .jpg
I want to insert if exists regardless of picture type.
Please help
Thanks
sunil
I have...
If Dir(Path$ & Pic$) < "" Then
ActiveSheet.Pictures.Insert(Path$ & Pic$).Select
Endif
|