We help IT Professionals succeed at work.
Get Started

Visual Basic 6.0 And OLE Automation for .. each error.

Last Modified: 2013-11-25
Since a couple of days I am encountering the following problem on my computer.
It worked but suddenly it stopped and I get the following error:

Run-time error '451':
Property let procedure not defined and property get procedure did not return an object.

In can only use the for .. each construct in Visual Basic without problems but when I create a Word or Excel object in Visual Basic and say I want to loop through the bookmark collection I will get the above error.
(I created some bookmarks first, so I have items in the bookmarks collection)
With the For .. Next construct I can show all bookmarks or paragraphs or whatever collection I have (word or excel).

I reinstalled My Office product (office XP small business).
I Installed service pack 5 for Visual Basic.
Both with no result.
I am referencing Microsoft Word 10 object library and Microsoft Excel 10 object library.

Summary: Can use the for .. each construct in VB 6.0
Can not use the for .. each construct on collections coming from office (Word or Excel)
Watch Question
This problem has been solved!
Unlock 2 Answers and 5 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE