Hi After going back over it the last one only deletes it out of the active file.
Mind the slopy programming I'm an engineer not a programmer.
This one should iterate through a few levels of assemblies and delete the "Autosave" sub from the "Autosave1" module
Sub Delete_AutoSave_In_All_Docs()
Dim oApp As Application
Set oApp = ThisApplication
Dim VBProj, VBComp, CodeMod, ProcName, vbext_pk_Proc, StartLine, NumLines
Set VBProj = oApp.VBAProjects
Dim k As Integer
For k = 1 To oApp.FileManager.Files.count
If oApp.FileManager.Files(k).AvailableDocuments(1).DocumentType = kAssemblyDocumentObject Then
Dim oFile As Document
Set oFile = oApp.Documents.Open(oApp.FileManager.Files(k).FullFileName)
Dim i, j
For i = 1 To VBProj.count
If VBProj(i).ProjectType <> kApplicationVBAProject Then
For j = 1 To VBProj(i).InventorVBAComponents.count
If VBProj(i).InventorVBAComponents(j).Name = ("AutoSave1") Then
Set VBComp = VBProj(i).InventorVBAComponents("AutoSave1").VBComponent
Set CodeMod = VBComp.CodeModule
ProcName = "AutoSave"
If CodeMod.countoflines > 10 Then
With CodeMod
StartLine = .ProcStartLine(ProcName, vbext_pk_Proc)
NumLines = .ProcCountLines(ProcName, vbext_pk_Proc)
.DeleteLines StartLine:=StartLine, count:=NumLines
End With
End If
End If
Next j
End If
Next i
'oFile.Close False
End If
Next k
End Sub
Let me know if this one works.
Dan