My ultimate goal is to be able copy charts from Excel worksheets (16 in all), and paste them into a Word document at known bookmarks, Inline with the text. I do not want the Word file to link to the Spreadsheet for reasons I won t go into here. I then need to be able delete these same charts later on before copying a new set into the document.
看来,诺言中的InLineShapes没有“Name”财产,只是一个指数,我认为该指数必须是“长”而不是“ger”。 当我点击我所复制的一张图表时,我用Edit>Sengon在Word Ribbon使用,我确实把每个图表的国名显示为图1等。
目前,我使用Excel工作手册中的以下编码,复制和将图表编成“言语”,似乎可以做些细。
This code will use Bookmarks to place the charts and copy them from this Workbook
For i = 1 To 16
Sheets(sheetnames(i)).Select
ActiveSheet.ChartObjects(Chartlocn(i)).Activate
ActiveChart.ChartArea.Copy
With d.Bookmarks(Bookmarklocn(i)).Range
.Select
objW.Selection.PasteSpecial Link:=False, DataType:=15, Placement:=wdInLine, _
DisplayAsIcon:=False
End With
Next i
我已尝试使用以下代码删除图表:
j = d.InlineShapes.Count
counter = 0
For i = 1 To d.InlineShapes.Count
counter = counter + 1
MsgBox (i)
If d.InlineShapes.Item(counter).Type = _
wdInlineShapePicture Then
d.InlineShapes.Item(counter).Select
objW.Selection.Delete Unit:=wdCharacter, Count:=1 Came from Macro Recording
Else
End If
Next i
上文评论的标语对我没有用处。
Despite checking everything I could imagine in the word file and Excel workbooks, each chart seems to be the same - all inline, all sequentially "names" Picture x, same method to copy and paste.
但所观察到的行为是,一些图表被删除,有些则没有。
是否有某种机制以某种方式确定图表,然后予以删除。 我知道,他们在书记处已经过去。 我没有明显的东西,也没有更好的复制和跟踪方法,因此我可以“以某些名字或身份识别符号来”他们?