Setting focus off an embedded Excel object withn a word document?

rudeboymcc

Registered User.
Local time
Today, 15:05
Joined
Sep 9, 2008
Messages
69
Hi. I've got a Word document which has an embedded Excel object. I am changing values of the word document and its excel object from VBA in Access.

So far I have:
Code:
For Each oIShape In .ActiveDocument.InlineShapes                 
    If InStr(1, oIShape.OLEFormat.ProgID, "Excel") Then 
          oIShape.OLEFormat.Activate                 
          Set oWB = oIShape.OLEFormat.Object     
          'Replace tHE Values                     
          oWB.Sheets(1).Range("B3").Value = "Test"                             
    End If             
Next oIShape
This works fine, but the excel object remains activated, which means I can't use the "savetopdf" command. All i want to do is close the object and go back to word (just like clicking away from the excel object if I was doing it manually).

Anyone have an idea of how to do this?? it took me ages to get this far and thisis the last hurdle :-D
 

Users who are viewing this thread

Back
Top Bottom