View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
okaizawa okaizawa is offline
external usenet poster
 
Posts: 129
Default Delete Sheets in VBA Project

Hi,
there might be hidden sheets in the workbook.
try the below,
(if the workbook was corrupt, it might crash excel)

Sub Test()
Dim vbc As Object
Debug.Print "***** " & ActiveWorkbook.Name & " *****"
For Each vbc In ActiveWorkbook.VBProject.VBComponents
If vbc.Type = 100 Then
If Not vbc.Properties("Parent").Object Is Application Then
Debug.Print vbc.Name, vbc.Properties("Name"), _
IIf(vbc.Properties("Visible") = -1, "Visible", "Hidden")
End If
End If
Next
End Sub

--
HTH,

okaizawa


Frank Rudd via OfficeKB.com wrote:
I've just completed a project that kind of developed "scope creep" (everybody
wanted me to add something), and even before I've linked it to other
workbooks, there will be four others, it's already kind of big. I've been
trying to clean up the code, and I see that in the project window of the VB
window it still lists worksheets that are no longer there. The interesting
thing is that the workbook originally contained 75 worksheets, that I've
condensed down to 8, but the project window shows those 8 plus 5 that have
been deleted and two chart sheets. It never had charts to begin w ith.I've
tried to delete these, there's no code in them, but I don't have that option
in the file menu. Are these adding to the file size? If so, how do I get rid
of them?

Any help is appreciated.