PC Review


Reply
Thread Tools Rate Thread

Active Sheet Error Message

 
 
George
Guest
Posts: n/a
 
      7th Nov 2008
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?


 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      7th Nov 2008
Debug.Print ActiveWorkbook.ActiveSheet.Name
--
Gary''s Student - gsnu200812
 
Reply With Quote
 
George
Guest
Posts: n/a
 
      7th Nov 2008
I get the same message on the line of code you suggested which is what I
already had previously


"Gary''s Student" <(E-Mail Removed)> wrote in message
newsED59EB2-EBE2-434A-8033-(E-Mail Removed)...
> Debug.Print ActiveWorkbook.ActiveSheet.Name
> --
> Gary''s Student - gsnu200812



 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      7th Nov 2008
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" <(E-Mail Removed)> wrote in message
> newsED59EB2-EBE2-434A-8033-(E-Mail Removed)...
> > Debug.Print ActiveWorkbook.ActiveSheet.Name
> > --
> > Gary''s Student - gsnu200812

>
>
>

 
Reply With Quote
 
George
Guest
Posts: n/a
 
      7th Nov 2008
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" <(E-Mail Removed)> wrote in message
news:88C953B8-18D9-4779-963D-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in
>> message
>> newsED59EB2-EBE2-434A-8033-(E-Mail Removed)...
>> > Debug.Print ActiveWorkbook.ActiveSheet.Name
>> > --
>> > Gary''s Student - gsnu200812

>>
>>
>>



 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      7th Nov 2008
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" <(E-Mail Removed)> wrote in message
> news:88C953B8-18D9-4779-963D-(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in
> >> message
> >> newsED59EB2-EBE2-434A-8033-(E-Mail Removed)...
> >> > Debug.Print ActiveWorkbook.ActiveSheet.Name
> >> > --
> >> > Gary''s Student - gsnu200812
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      7th Nov 2008
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" <(E-Mail Removed)> wrote in message
> news:88C953B8-18D9-4779-963D-(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in
> >> message
> >> newsED59EB2-EBE2-434A-8033-(E-Mail Removed)...
> >> > Debug.Print ActiveWorkbook.ActiveSheet.Name
> >> > --
> >> > Gary''s Student - gsnu200812
> >>
> >>
> >>


--

Dave Peterson
 
Reply With Quote
 
George
Guest
Posts: n/a
 
      7th Nov 2008
That was a good suggestion. I was running the macro against a large sheet
that had been cut and pasted from a web site. I started over with a New
workbook, pasted a smaller number of rows and it ran fine.

I'm running Excel 2000. I'm guessing that there was some kind of memory
overlap problem with the extra large number of row. Very strange behavior.

The first sheet I was using had 528 rows, the 2nd time I ran the sheet had
about 324. That seems very odd.

Both data sets are from the same web site, just a smaller number of rows,
same headers and footers.


"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in
>> message
>> news:88C953B8-18D9-4779-963D-(E-Mail Removed)...
>> > 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" <(E-Mail Removed)> wrote in
>> >> message
>> >> newsED59EB2-EBE2-434A-8033-(E-Mail Removed)...
>> >> > Debug.Print ActiveWorkbook.ActiveSheet.Name
>> >> > --
>> >> > Gary''s Student - gsnu200812
>> >>
>> >>
>> >>

>
> --
>
> Dave Peterson



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      7th Nov 2008
Maybe you can delete the old worksheet and recreate it from the web page?

George wrote:
>
> That was a good suggestion. I was running the macro against a large sheet
> that had been cut and pasted from a web site. I started over with a New
> workbook, pasted a smaller number of rows and it ran fine.
>
> I'm running Excel 2000. I'm guessing that there was some kind of memory
> overlap problem with the extra large number of row. Very strange behavior.
>
> The first sheet I was using had 528 rows, the 2nd time I ran the sheet had
> about 324. That seems very odd.
>
> Both data sets are from the same web site, just a smaller number of rows,
> same headers and footers.
>
> "Dave Peterson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in
> >> message
> >> news:88C953B8-18D9-4779-963D-(E-Mail Removed)...
> >> > 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" <(E-Mail Removed)> wrote in
> >> >> message
> >> >> newsED59EB2-EBE2-434A-8033-(E-Mail Removed)...
> >> >> > Debug.Print ActiveWorkbook.ActiveSheet.Name
> >> >> > --
> >> >> > Gary''s Student - gsnu200812
> >> >>
> >> >>
> >> >>

> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
George
Guest
Posts: n/a
 
      7th Nov 2008
That's what I wound up doing. Created new worksheet and then pasted in the
smaller number of rows, and my macro ran fine to completion.


"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Maybe you can delete the old worksheet and recreate it from the web page?
>
> George wrote:
>>
>> That was a good suggestion. I was running the macro against a large
>> sheet
>> that had been cut and pasted from a web site. I started over with a New
>> workbook, pasted a smaller number of rows and it ran fine.
>>
>> I'm running Excel 2000. I'm guessing that there was some kind of memory
>> overlap problem with the extra large number of row. Very strange
>> behavior.
>>
>> The first sheet I was using had 528 rows, the 2nd time I ran the sheet
>> had
>> about 324. That seems very odd.
>>
>> Both data sets are from the same web site, just a smaller number of rows,
>> same headers and footers.
>>
>> "Dave Peterson" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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" <(E-Mail Removed)> wrote in
>> >> message
>> >> news:88C953B8-18D9-4779-963D-(E-Mail Removed)...
>> >> > 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" <(E-Mail Removed)> wrote in
>> >> >> message
>> >> >> newsED59EB2-EBE2-434A-8033-(E-Mail Removed)...
>> >> >> > Debug.Print ActiveWorkbook.ActiveSheet.Name
>> >> >> > --
>> >> >> > Gary''s Student - gsnu200812
>> >> >>
>> >> >>
>> >> >>
>> >
>> > --
>> >
>> > Dave Peterson

>
> --
>
> Dave Peterson



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when closing file window with Active X sheet in document directionalman Microsoft Excel Crashes 0 7th May 2006 04:32 PM
Copy from active sheet and paste into new sheet using info from cell in active Ingve Microsoft Excel Programming 3 23rd Jan 2006 09:57 PM
Select Named Range - Active sheet - Message Box address al007 Microsoft Excel Programming 3 7th Dec 2005 07:36 AM
Active X error Message Diane Windows XP Internet Explorer 1 16th Jan 2004 01:53 PM
Active X error message Mary Windows XP Internet Explorer 1 7th Nov 2003 01:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:48 PM.