• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

  • Forum yazılımı güncelenmiştir.

    Beklenmedik durumlar görürseniz lütfen yönetime iletin.

Userforma Tüm Uzantılarda Resim Çağırma

Katılım
19 Eylül 2012
Mesajlar
322
Excel Vers. ve Dili
2010 türkçe
Merhaba değerli üstatlar.

Aşağıdaki kodlarla Userforma Jpg formatında resim çağırabiliyorum. Çağırılacak resim eğer jpg formatında değil de jpeg formatında yada png formatında ise resmi yine de çağırmak için kodda nasıl bir değişiklik yapmalıyım. Yani "RESİM" adlı klasördeki "CİVATA" adlı resim jpg, jpeg, png yada gif uzantılı olsa bile yine de çağırılsın.

Private Sub TextBox1_Change()
On Error Resume Next
ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".Jpg"
If Dir(ResimDosya) = "" Then
Image1.Visible = False
Else
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".Jpg")
End If
End Sub
 
Deneyiniz.

C++:
Private Sub TextBox1_Change()
On Error Resume Next
ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".*"
If Dir(ResimDosya) = "" Then
Image1.Visible = False
Else
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & ResimDosya)
End If
End Sub
 
Merhaba

Alternatif Çalışma

Private Sub TextBox1_Change()

On Error Resume Next

ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".jpg"
If Dir(ResimDosya) <> "" Then
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".jpg")
exit sub
end if

ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".jpeg"
If Dir(ResimDosya) <> "" Then
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".jpeg")
exit sub
end if

ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".png"
If Dir(ResimDosya) <> "" Then
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".png")
exit sub
end if


ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".gif"
If Dir(ResimDosya) <> "" Then
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".gif")
exit sub
end if

Image1.Visible = False

End Sub
 
png uzantılı dosyalar userformda image nesnesinde görüntülenemez.
bunun için dosyada dönüşüm yapmak gerekir
 
Deneyiniz.

C++:
Private Sub TextBox1_Change()
On Error Resume Next
ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".*"
If Dir(ResimDosya) = "" Then
Image1.Visible = False
Else
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & ResimDosya)
End If
End Sub
çok teşekkür ederim.
 
Merhaba

Alternatif Çalışma

Private Sub TextBox1_Change()

On Error Resume Next

ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".jpg"
If Dir(ResimDosya) <> "" Then
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".jpg")
exit sub
end if

ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".jpeg"
If Dir(ResimDosya) <> "" Then
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".jpeg")
exit sub
end if

ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".png"
If Dir(ResimDosya) <> "" Then
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".png")
exit sub
end if


ResimDosya = ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".gif"
If Dir(ResimDosya) <> "" Then
Image1.Visible = True
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\RESİM\" & TextBox1 & ".gif")
exit sub
end if

Image1.Visible = False

End Sub
çok teşekkür ederim.
 
Geri
Üst