- Katılım
- 10 Mart 2013
- Mesajlar
- 187
- Excel Vers. ve Dili
- 2016 - İngilizce
BU kodda farklı değişkenleri kırmızı ile işaretledim
Kod:Dim Say Dim dosyalar(5000) Dim dosyalar2(5000) Sub mevcut_dosyaları_bul3() Set Klasor = CreateObject("shell.application").browseforfolder(0, "Kaynak Dosyaları İçeren Klasörü Seçin", 50, &H0) If Not Klasor Is Nothing Then Kaynak = Klasor.SELF.Path If InStr(1, Kaynak, "{") > 0 Then GoTo atla Say = 0 Application.ScreenUpdating = False Application.DisplayAlerts = False Range("A2:Z5000").ClearContents Liste1 (Kaynak) Aranan1 = "Metin Kutusu: " Aranan2 = "Text Box: " [COLOR="Red"]bulunan1 = "Sn." bulunan2 = "T.C."[/COLOR] For i = 1 To Say Dim objWord As Word.Application Dim docWord As Word.Document Set objWord = CreateObject("Word.Application") objWord.Visible = True Yol = dosyalar(i) Set docWord = objWord.Documents.Open(Filename:=Yol, ReadOnly:=True) sut = 3 t = WorksheetFunction.CountA(Worksheets(ActiveSheet.Name).Range("A2:A" & Rows.Count)) + 2 ThisWorkbook.Sheets(ActiveSheet.Name).Cells(t, 1) = dosyalar(i) ThisWorkbook.Sheets(ActiveSheet.Name).Cells(t, 2) = dosyalar2(i) Dim Picture As Object For Each Picture In objWord.ActiveDocument.Shapes 'If "Rectangle 4" = Picture.Name Then If "Rectangle" = Mid(Picture.Name, 1, 9) Then Deg = Replace(Replace(WorksheetFunction.Trim(objWord.ActiveDocument.Shapes(Picture.Name).AlternativeText), Chr(13), ""), Chr(9), "") deg2 = Split(Deg, Aranan1) If UBound(deg2) > 0 Then Deg = deg2(1) End If deg3 = Split(Deg, Aranan2) If UBound(deg3) > 0 Then Deg = deg3(1) End If If Mid(Deg, 1, Len(bulunan1)) = bulunan1 Or Mid(Deg, 1, Len(bulunan2)) = bulunan3 Then ThisWorkbook.Sheets(ActiveSheet.Name).Cells(t, sut).Value = Deg deg1 = Split(Deg, Chr(10)) If UBound(deg1) > 0 Then For j = 0 To UBound(deg1) If deg1(j) <> "" Then sut = sut + 1 ThisWorkbook.Sheets(ActiveSheet.Name).Cells(t, sut).Value = deg1(j) End If Next j End If Exit For End If End If Next Picture docWord.Close False objWord.Quit Set docWord = Nothing Next i Cells.WrapText = False Set Klasor = Nothing MsgBox "işlem tamam" Else atla: MsgBox "Lütfen Kaynak Klasör Seçimini Yapınız !", vbInformation, "DİKKAT" End If End Sub Private Sub Liste1(Yol As String) Dim fL As Object, fs As Object, f As Object, j As Long, n As Long Set fL = CreateObject("Scripting.FileSystemObject") For Each Dosya In fL.GetFolder(Yol).Files uzanti = LCase(fL.GetExtensionName(Dosya.Name)) dosya_adi = fL.GetBaseName(Dosya) If uzanti = "doc" Or uzanti = "docx" Then Say = Say + 1 dosyalar(Say) = Dosya dosyalar2(Say) = Dosya.Name End If Next On Error GoTo sonraki For Each f In fL.GetFolder(Yol).SubFolders Liste1 (f.Path) sonraki: Next Set fL = Nothing End Sub
Üstadım merhaba,
Bankamızın cevap yazılarında bir değişikliğe gidildi ve sabit olan rectangle 4 cevap yazılarımızda farklılık gösterebiliyor. Bunu rectangle 4 olarak sabitlemek yerine T.C., Sn. v.s belirleyeceğimiz kriterler doğrultusunda çalışabilmesi için entegre edebilir miyim?
Değerli bilgilerinizi rica ederim.
