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.
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