How to delete embedded Word object?

Discussion in 'Access VBA Modules' started by BlueBullDog, Jun 2, 2010.

  1. BlueBullDog

    BlueBullDog Guest

    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.
     
    BlueBullDog, Jun 2, 2010
    #1
    1. Advertisements

  2. On Wed, 2 Jun 2010 06:53:01 -0700, BlueBullDog
    <> wrote:

    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


    >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, Jun 2, 2010
    #2
    1. Advertisements

  3. BlueBullDog

    BlueBullDog Guest

    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?

    "Tom van Stiphout" wrote:

    > On Wed, 2 Jun 2010 06:53:01 -0700, BlueBullDog
    > <> wrote:
    >
    > 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
    >
    >
    > >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.

    > .
    >
     
    BlueBullDog, Jun 2, 2010
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Pete

    Open embedded object problem

    Pete, Jul 2, 2003, in forum: Access VBA Modules
    Replies:
    0
    Views:
    182
  2. jon
    Replies:
    0
    Views:
    296
  3. Kevin K. Sullivan

    Save embedded OLE object as a file

    Kevin K. Sullivan, Apr 29, 2004, in forum: Access VBA Modules
    Replies:
    3
    Views:
    107
    John Nurick
    May 3, 2004
  4. dongatlin

    err "The object you referenced isn't an OLE object"

    dongatlin, Oct 15, 2004, in forum: Access VBA Modules
    Replies:
    4
    Views:
    287
    dongatlin
    Oct 19, 2004
  5. graeme34 via AccessMonster.com

    How to run an embedded delete query in VBA

    graeme34 via AccessMonster.com, Mar 23, 2006, in forum: Access VBA Modules
    Replies:
    5
    Views:
    93
    Brendan Reynolds
    Mar 24, 2006
  6. Appache
    Replies:
    0
    Views:
    119
    Appache
    Jun 12, 2006
  7. J Welsby

    Output embedded object to a file

    J Welsby, Mar 24, 2008, in forum: Access VBA Modules
    Replies:
    3
    Views:
    90
    Stephen Lebans
    Mar 25, 2008
  8. -Jeff-

    Convert OLE linked object to embedded

    -Jeff-, Jun 5, 2008, in forum: Access VBA Modules
    Replies:
    0
    Views:
    167
    -Jeff-
    Jun 5, 2008
Loading...