How to delete embedded Word object?



I have an embedded Word document in an unbound object frame. I want to delete
the object from the object frame using VBA. How do I do it?

My goal is to let the user select Word documents and edit them in-place in
the unbound object frame, so I have to remove the existing object and replace
it with another. I've tried changing SourceDoc, but it does nothing. I've
tried setting the Action to acOLEDelete and that also does nothing.

Tom van Stiphout

On Wed, 2 Jun 2010 06:53:01 -0700, BlueBullDog

This worked for me and switched to the second doc:
OLEUnbound23.Action = acOLEDelete
OLEUnbound23.SourceDoc = "c:\test2.doc"
OLEUnbound23.Action = acOLECreateLink

Be sure your control is set to Enabled=True, Locked=False.

Microsoft Access MVP



Many thanks! I have looked several days for that simple solution. To get
the object to disappear, I used this:

Me.oleDoc.Action = acOLEDelete
Me.oleDoc.SourceDoc = ""
Me.oleDoc.Action = acOLECreateEmbed

Question: If I am adding and removing documents over and over again from
the unbound object frame, does the code above really remove the object from
the database so that the database does not incrementally inflate with each
new object that I bring in?

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