Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm getting the error message below from VBA from the following code on Line
2 Debug.Print ActiveWorkbook.Name Debug.Print ActiveWorkbook.ActiveSheet Run-time error '-2147319765 (8002802b)' Automation Error Element not found. I added ActiveWorkbook as a Watch Expression in the Watch window, and I can click on the + and I can see an entry as a child record for ActiveSheet. I can click on the ActiveSheet entry and see the name of the ActiveSheet. The element clearly is there in the Watch Window but not seen in the program. Why is VB telling me the Automation Object can't be found? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Debug.Print ActiveWorkbook.ActiveSheet.Name
-- Gary''s Student - gsnu200812 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get the same message on the line of code you suggested which is what I
already had previously "Gary''s Student" wrote in message ... Debug.Print ActiveWorkbook.ActiveSheet.Name -- Gary''s Student - gsnu200812 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi George:
Put your lines of code in a sub in a standard module and try them there -- Gary''s Student - gsnu200812 "George" wrote: I get the same message on the line of code you suggested which is what I already had previously "Gary''s Student" wrote in message ... Debug.Print ActiveWorkbook.ActiveSheet.Name -- Gary''s Student - gsnu200812 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is what my entire Sub looks like, its failing on line 2 as described
before Sub DelShapesOnSht() Dim shp As Shape Debug.Print ActiveWorkbook.Name Debug.Print ActiveWorkbook.ActiveSheet.Name Debug.Print ActiveWorkbook.ActiveSheet.Shapes.Count If ActiveWorkbook.ActiveSheet.Shapes.Count 0 Then For Each shp In ActiveWorkbook.ActiveSheet.Shapes shp.Delete 'Delete the shape Next shp End If End Sub "Gary''s Student" wrote in message ... Hi George: Put your lines of code in a sub in a standard module and try them there -- Gary''s Student - gsnu200812 "George" wrote: I get the same message on the line of code you suggested which is what I already had previously "Gary''s Student" wrote in message ... Debug.Print ActiveWorkbook.ActiveSheet.Name -- Gary''s Student - gsnu200812 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I pasted your code (as posted) into a standard module on my computer and it
ran without problems. It even deleted a Shape. -- Gary''s Student - gsnu200812 "George" wrote: This is what my entire Sub looks like, its failing on line 2 as described before Sub DelShapesOnSht() Dim shp As Shape Debug.Print ActiveWorkbook.Name Debug.Print ActiveWorkbook.ActiveSheet.Name Debug.Print ActiveWorkbook.ActiveSheet.Shapes.Count If ActiveWorkbook.ActiveSheet.Shapes.Count 0 Then For Each shp In ActiveWorkbook.ActiveSheet.Shapes shp.Delete 'Delete the shape Next shp End If End Sub "Gary''s Student" wrote in message ... Hi George: Put your lines of code in a sub in a standard module and try them there -- Gary''s Student - gsnu200812 "George" wrote: I get the same message on the line of code you suggested which is what I already had previously "Gary''s Student" wrote in message ... Debug.Print ActiveWorkbook.ActiveSheet.Name -- Gary''s Student - gsnu200812 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you create a test workbook and add some shapes, does your code work ok?
I'd guess that your workbook is corrupted some way. Maybe you activate a different sheet in your real workbook and test it there. Maybe it's just that single sheet that's a problem. George wrote: This is what my entire Sub looks like, its failing on line 2 as described before Sub DelShapesOnSht() Dim shp As Shape Debug.Print ActiveWorkbook.Name Debug.Print ActiveWorkbook.ActiveSheet.Name Debug.Print ActiveWorkbook.ActiveSheet.Shapes.Count If ActiveWorkbook.ActiveSheet.Shapes.Count 0 Then For Each shp In ActiveWorkbook.ActiveSheet.Shapes shp.Delete 'Delete the shape Next shp End If End Sub "Gary''s Student" wrote in message ... Hi George: Put your lines of code in a sub in a standard module and try them there -- Gary''s Student - gsnu200812 "George" wrote: I get the same message on the line of code you suggested which is what I already had previously "Gary''s Student" wrote in message ... Debug.Print ActiveWorkbook.ActiveSheet.Name -- Gary''s Student - gsnu200812 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error message in my Excel sheet | Excel Worksheet Functions | |||
copy sheet error message | New Users to Excel | |||
Active X Error message | Excel Discussion (Misc queries) | |||
Copy from active sheet and paste into new sheet using info from cell in active | Excel Programming | |||
Error message with protected sheet | Excel Discussion (Misc queries) |