insert picture
If I knew the possible extensions, I'd just try them until I found it:
dim myExtensions as variant
dim eCtr as long
dim Pic as string
dim PicName as string
dim FoundIt as boolean
dim myPath as string
myextensions = array("bmp","gif","jpg", "jpeg")
pic = "123456"
mypath = "C:\something\"
foundit = false
for ectr = lbound(myextensions) to ubound(myextensions)
picname = mypath & pic & "." & myextensions(ectr)
if dir(picname) = "" then
'keep looking
else
exit for
foundit = true
end if
next ectr
if foundit = false then
msgbox "Not found"
else
'insert picname
end if
sunilpatel wrote:
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
--
Dave Peterson
|