Quote:
Originally Posted by macropod
So use VBA code to change the link filenames. Trivial compared to what you're trying to do now. Even with inconsistent filenaming, all you need is a dialog box for selecting the source file. This can all be done from within Word and, depending on what you want to do can be done via DATABASE fields or possibly ADODB - the latter without even opening the workbook. Think about it.
|
Thanks for the input, macropod, that's for sure something I will think about!

You say: "all you need is a dialog box for selecting the source file" - that's actually the key point: Around 50 graphs in the document, around 10 people working on it, so there are plenty of source files (that's why I try to gather them in a reference file)...
For the moment, I could achieve what I wanted to do with graphs. As often, a small mistake was hindering me: I noticed the graphs I am working with are not of type chartObject or Chart, but they are actually shapes! Therefore, the code in my previous post always jumped to the "else" condition.
I replaced this code block and now loop through the shapes:
Code:
Dim shp As Excel.Shape
For Each shp In xlSheet.Shapes
If shp.Type = msoChart And shp.Name = rangeOrChart Then
shp.Copy
If doc.Bookmarks.Exists(wordBookmark) Then
Set bmRange = doc.Bookmarks(wordBookmark).Range
bmRange.Paste
doc.Bookmarks.Add wordBookmark, bmRange
End If
chartFound = True
Exit For
End If
Next shp
Thanks again to both of you for your valuable guidance! Now, let's go for the tables in the document