Unable to loop on Excel collections. Error 451.

  • Thread starter Thread starter oliviers
  • Start date Start date
O

oliviers

Hi,

I encountered a strange issue on one of my customers's laptop.
My app (vb6) is working with Excel and is crashing on lines of code
like :

For each objSheet in MyWorkbook.Sheets

I tried 2 cases, when objSheet is defined as object or as worksheet,
it generates the error "Runtime error '451':
Property let procedure not defined and property get procedure did not
return an object".

I guess the sheets object is not considered as a collection and I'm
wondering why because my app is just working fine for any other user.
Some library corruption?

Thanks,

Olivier
 
Sheets is a collection for sure but it includes all types of sheets (Chart
sheets, dialog sheets,..).

It may not help but if you want to get just worksheets you should user the
Worksheets collection.

--
Jim
| Hi,
|
| I encountered a strange issue on one of my customers's laptop.
| My app (vb6) is working with Excel and is crashing on lines of code
| like :
|
| For each objSheet in MyWorkbook.Sheets
|
| I tried 2 cases, when objSheet is defined as object or as worksheet,
| it generates the error "Runtime error '451':
| Property let procedure not defined and property get procedure did not
| return an object".
|
| I guess the sheets object is not considered as a collection and I'm
| wondering why because my app is just working fine for any other user.
| Some library corruption?
|
| Thanks,
|
| Olivier
 
Sheets is a collection for sure but it includes all types of sheets (Chart
sheets, dialog sheets,..).

It may not help but if you want to get just worksheets you should user the
Worksheets collection.

--

| Hi,
|
| I encountered a strange issue on one of my customers's laptop.
| My app (vb6) is working with Excel and is crashing on lines of code
| like :
|
| For each objSheet in MyWorkbook.Sheets
|
| I tried 2 cases, when objSheet is defined as object or as worksheet,
| it generates the error "Runtime error '451':
| Property let procedure not defined and property get procedure did not
| return an object".
|
| I guess the sheets object is not considered as a collection and I'm
| wondering why because my app is just working fine for any other user.
| Some library corruption?
|
| Thanks,
|
| Olivier

I will give it a try and let you know.
Thanks for the suggestion.

Olivier
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top