Word 2007 Chart Automation problem

S

seansullivan99

I have a Word document which contains a table which contains a chart.
I wish to automate this from some VBA code which is an Excel document.
Here is the code:-


Dim oMSGraphWrapper As Word.InlineShape
Dim oMSGraphObject As Object
Set oMSGraphWrapper =
ActiveDocument.Tables(1).Range.InlineShapes(1)
oMSGraphWrapper.OLEFormat.Edit
...........

This works fine if the document is saved as an old style .doc file. If
I save the document as a new ".docm" macro enabled document I recieve
the error "91 Object variable or With Block variable not set. on the
last line of the code above.

All help appreciated.
 
S

seansullivan99

Problem solved:-

When I saved the document as a new style ".docm" Word changed the
object type from an embedded Graph to a Chart. I expect this may bite
a few others so beware.
 

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

Top