raporlama hatası

Katılım
21 Ocak 2013
Mesajlar
422
Excel Vers. ve Dili
2010
daha önce office 2007 kullanıyordum ancak office 2010 kullanıyorum şimdi raporlama yaparken

For Each component In ActiveWorkbook.VBProject.VBComponents

burda bir hata alıyorum nasıl düzeltebilirim.


Kod:
Private Sub cmdexcelrapor_Click()
Dim oWSHShell As Object
sor = MsgBox("GELEN EVRAK LİSTESİ EXCEL'e RAPORLANSINMI ?", vbYesNo + vbInformation, "BİLDİRİ")
If sor = vbNo Then Exit Sub
Set oWSHShell = CreateObject("WScript.Shell")
Klasor = oWSHShell.SpecialFolders("Desktop")
Set oWSHShell = Nothing
With Application
    .ScreenUpdating = False
    .EnableEvents = False
End With
Dim ds, a
Set ds = CreateObject("Scripting.FileSystemObject")
Dim sayfa As Worksheet
For Each sayfa In Worksheets
    If sayfa.Name = "GELENEVRAK" Then
        For i = Len(ThisWorkbook.Name) To 1 Step -1
            If Mid(ThisWorkbook.Name, i, 1) = "." Then
                Dosya_adi = Mid(ThisWorkbook.Name, 1, i - 1)
                Exit For
            End If
        Next
        sayfa.Copy
        deger = Dosya_adi & " " & Format(Now, "yyyymmdddd hhmmss") & ".xlsx"
        ActiveSheet.DrawingObjects.Delete
        For Each component In ActiveWorkbook.VBProject.VBComponents
            If component.Type <> 100 Then
                ActiveWorkbook.VBProject.VBComponents.Remove component
            Else
                Set modul = component.CodeModule
                modul.DeleteLines 1, modul.CountOfLines
            End If
        Next
        Dim wb As Workbook
        Set wb = ActiveWorkbook
        Application.DisplayAlerts = False
            With wb
                .SaveAs Klasor & Application.PathSeparator & deger
                .Close SaveChanges:=False
            End With
        Application.DisplayAlerts = True

        With Application
            .ScreenUpdating = True
            .EnableEvents = True
        End With
    End If
Next
End Sub
 

AdemCan

Altın Üye
Destek Ekibi
Katılım
1 Eylül 2008
Mesajlar
1,386
Excel Vers. ve Dili
2019 TR
Excel Seçenekleri Makro Ayarlarından resimde gösterdiğim seçeneği işaretleyiniz.
241554
 

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
42,160
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Aşağıdaki işlemi yapınız.

  1. Dosya sekmesini tıklatın.
  2. Seçenekler'e tıklayın.
  3. Güven Merkezi'ne ve ardından Güven Merkezi Ayarları'na tıklayın.
  4. Güven Merkezi'nde Makro Ayarları'na tıklayın.
"VBA proje nesne modeline erişime güven" seçeneğini işaretleyiniz.
 
Üst