Need to change linked graphs Excel-source

T

Thomas

I´m using Office 2003
I have a lot of linked Excel-graphs (60) in my Word document. I want to
change the source-file by code.
I think I can use the properties ProgID and Linkformat to do this.
But when I type in this little testcode:

Sub test()
Dim s As Shape
For Each s In ActiveDocument.Shapes
Debug.Print s.OLEFormat.ProgID
Next s
End Sub

I always get the error:
"Object variable or With block variable not set"
I can´t understand what i have missed to declare.
Anyone have an idea of whats wrong or if some other method is better to use?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?VGhvbWFz?=,

Do you have graphical objects in the file that aren't OLE objects?
Pictures, for example? If you try to run this on another kind of Shape,
you'll get that error message (I just tested). Take a look in the
ObjectBrowser at the Enums for the Type property of the Shape object.
There should be one in there that tests whether it's OLE.
I´m using Office 2003
I have a lot of linked Excel-graphs (60) in my Word document. I want to
change the source-file by code.
I think I can use the properties ProgID and Linkformat to do this.
But when I type in this little testcode:

Sub test()
Dim s As Shape
For Each s In ActiveDocument.Shapes
Debug.Print s.OLEFormat.ProgID
Next s
End Sub

I always get the error:
"Object variable or With block variable not set"
I can´t understand what i have missed to declare.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
T

Thomas

Maye I´m wrong

I have made my linkes this way.
Multiple graphs has been (from different sheets in same .xls-file)
linked to a 70 page word document (on various sheets) by "copying" the
graph(s) in the Spreadsheet and then "pasting special" onto the word
document as an MS Office Excel Chart Object. I have also copied cells and
"paste special" as formatted text.

I hope you can give me some ideas

Hälsningar
Thomas
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?VGhvbWFz?=,
I have made my linkes this way.
Multiple graphs has been (from different sheets in same .xls-file)
linked to a 70 page word document (on various sheets) by "copying" the
graph(s) in the Spreadsheet and then "pasting special" onto the word
document as an MS Office Excel Chart Object. I have also copied cells and
"paste special" as formatted text.
If you press Alt+F9 to toggle the field codes do you see LINK fields? If you
do, then these are InlineShapes, not Shapes. But my question still remains:
have you inserted other things into the document, as well?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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