How to delete embedded Word object?

  • Thread starter Thread starter BlueBullDog
  • Start date Start date
B

BlueBullDog

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.
 
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.

-Tom.
Microsoft Access MVP
 
Tom,

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?
 
On Wed, 2 Jun 2010 15:28:24 -0700, BlueBullDog

I don't know but diskspace is cheap and the occasional Compact will
take care of bloat if it were to occur.

-Tom.
Microsoft Access MVP
 
Back
Top