Excel VBA DERS-13 / Excel VBA COURSE-13
What Will I Learn? / Ne Öğreneceğim?
- Excel VBA dili
- Makro Kullanımı
- Program Tasarımı
Requirements / Gereksinimler
-Microsoft Office 2007 ve üstü sürüm
Difficulty /Zorluk
Orta Düzey
Tutorial Contents / Eğitim İçeriği
Merhaba arkadaşlar bugün 13. dersimize geçtik. Excel VBA dili ile daha önceki hazırladığımız proje üzerine program yapmaya devam ediyorum. Bugün sizlere bilgi girişi ekranında kişiye nasıl fotoğraf ekleneceğini göstereceğim. Daha önce biz bilgi girişi ekranı hazırlamıştık. Öncelikle onu görsel olarak atarak başlayacağım. Adım adım resim ekleme kodunu programımıza ekleyelim.
Hello friends, we passed our 13th class today. With Excel VBA language I continue to program on the project we have already prepared. Today it shows you that your photos will be added. Previously, we had the information input screen. First I'll start by visually throwing it away. I'll add the code for adding pictures step by step.
1- Excel VBA dili ile program yapmaya başladığımız dersten beri hazırladığımız projelerde bir kişinin veri girişi ekranını hazırlamıştık. Hazırladığımız bu ekranı excel veri tabanına eklemeyi göstermiştik. Bunun görsellerini aşağıya ekledim.
1- Since we started to program with Excel VBA language, we have prepared a person's data entry screen in projects we have prepared since. We showed you how to add this screen to the excel database. I've added the visuals below.
2- İlk olarak proje ekranımıza resim ekleyebileceğimiz şekilde düzenleyelim. Daha sonra "ToolBox" menüsünde "Image" aracını oluşturduğumuz alana ekleyelim. Görselleri aşağıya ekledim.
2- First, let's edit the project screen so that we can add images. Then, in the "ToolBox" menu, we add the "Image" tool to the area we created. I've added the images below.
3- "İmage" aracını ekledikten sonra eklediğimiz aracın altına "CommandButton" aracını ekleyelim. (CommandButton) Adını "Resim Ekle" olarak değiştirelim.
3- After adding the "Image" tool, add the "CommandButton" tool under the tool we added. (CommandButton) Change the name to "Add Picture".
4- "Image" aracını ekledikten sonra excel veritabanına resmin bağlantısını ekleyeceğimiz sütunu oluşturalım
4- After adding the "Image" tool, create the column to add the link to the excel database
5- Fotoğraf eklediğimizde fotoğrafların dosya yolunu gösterebilecek bir adet textbox aracı ekleyelim. Bu aracı proje ekranında nereye koyacağımız önemli değil çünkü programı çalıştırdığımızda bu aracın görünmemesini sağlayacağız.
5- When we add a photo, we will add a TextBox tool that can show the file path of the photos. It does not matter where we put this tool on the project screen, because when we run the program we will not see this tool.
6- Resim ekleme ile ilgili tasarımımız bu işlemlerden sonra bitti. Şimdi Resim ekle butonuna iki kez tıkladığımızda kod yazma ekranı açılacaktır. Açılan kod sayfasında daha önceki derslerde eklediğimiz kodlarda bulunmaktadır. Bu kodları silmeden imlecin bulunduğu kod aralığına yeni kodlarımızı yazalım.
6- Our design related to adding pictures is over after this process. Now double-click the Add picture button to open the code writing screen. In the code page that opens, we have included the code we added in the previous lessons. Without deleting these codes, let's write our new codes into the code range where the cursor is located.
NOT : Eklediğimiz kodlar yukarıdaki görselde bulunan kırmızı kutunun içerisindeki kodlardır. Dosya yolu için oluşturduğunuz "textbox" ismi ne ise (TextBox6.Text = vFile) bu kodu ona göre düzenlememiz gerekiyor.
NOTE: The codes we added are the codes in the red box in the image above. What is the name of the "textbox" you created for the file path (TextBox6.Text = vFile), we need to edit this code accordingly.
7- Kodlarımızı denediğimizde aşağıya eklediğim görseldeki gibi resmin "Image" aracına geldiğini göreceksiniz. Yazdığımız kodu deneyebilmek için "Run Sub/UserForm" butonuna basınız ve resim ekle butonundan bilgisayarında bulunan bir resmi ekleyiniz. "Image" aracına gelen resmin boyutları araca sığmıyor ise "Image" aracına bir kez tıkladığımızda sağda bulunan "Properties" menüsünden "PictureSizeMode" ayarını "fmPictureSizeModeStretch" olarak değiştirin.
7- When we try our codes, you will see that you come to the "Image" tool as you see below. To test the code we have written, press the "Run Sub / UserForm" button and add an image from the add image button on the computer. If the size of the image that comes to the "Image" tool does not fit in the middle, once you click on the "Image" tool, change the setting of "PictureSizeMode" to "fmPictureSizeModeStretch" in the "Properties" menu on the right.
8- Yazdığımız kod ile Image nesnesine resim eklemeyi gördük. Şimdi bu resmi kişi ile bağlantılı hale getirebilmek için "KAYDET" butonuna yazdığımız kodları resim için yeni kod ekleyeceğiz. Bunun için "KAYDET" butonuna iki kez tıkladığımızda kod yazma sayfamız açılacaktır.
8- We have seen that we can add pictures to the Image object with the code we wrote. Now we can add the new code for the picture that we wrote in the "SAVE" button to link this picture to the person. If we double click on the "SAVE" button for this, our code writing page will be opened.
9- Açılan kod sayfasında aşağıya eklediğim görseldeki gibi kodları düzenleyelim.
9- I will edit the codes as shown below in the code page that opens.
Arkadaşlar bir kişiye ait fotoğraf ekleme işlemi bu şekildedir. Bir sonraki dersimizde eklediğimiz resmi değiştirmeyi ve ListBox nesnesinde kişiyi seçtiğimizde resminiz "İmage" aracına gelmesini göstereceğim.
Buraya kadar okudunuz için teşekkür ederim.
This is the process of adding photos belonging to a friend. We will change the picture we added in the next lesson, and when we select the person in the ListBox object, I'll show your picture to the "Image" tool.
















Your contribution cannot be approved because it does not refer to or relate to an open-source repository. See here for a definition of "open-source."
You can contact us on Discord.
[utopian-moderator]