vba word:如何选择图像?
因此,对于我的特定应用程序,我希望能够在从Excel复制图像后选择图像,然后插入标题 我可以使用以下方法成功复制图像:vba word:如何选择图像?,vba,ms-word,Vba,Ms Word,因此,对于我的特定应用程序,我希望能够在从Excel复制图像后选择图像,然后插入标题 我可以使用以下方法成功复制图像: docapp.Selection.Range.PasteSpecial DataType:=wdPasteEnhancedMetafile, Placement:=wdInLine 然而,我有很多困难只是选择最近复制的图像,所以我可以使用 Selection.InsertCaption 选择图像的最佳方式是什么 好吧,我是个白痴,已经解决了我自己的问题。这不是最漂亮的代码,
docapp.Selection.Range.PasteSpecial DataType:=wdPasteEnhancedMetafile, Placement:=wdInLine
然而,我有很多困难只是选择最近复制的图像,所以我可以使用
Selection.InsertCaption
选择图像的最佳方式是什么 好吧,我是个白痴,已经解决了我自己的问题。这不是最漂亮的代码,但它很有效: 关键是使用document.InlineShapes。选择:
Public Sub Chart2Word(chto As Chart, doc1 As Word.Document, docapp As Word.Application, _
Optional Title As Variant)
Dim objpic As Word.InlineShape
docapp.Activate
chto.CopyPicture
docapp.Selection.MoveEnd wdStory
docapp.Selection.Move
docapp.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
docapp.Selection.Range.PasteSpecial DataType:=wdPasteEnhancedMetafile, Placement:=wdInLine
doc1.InlineShapes(doc1.InlineShapes.Count).Select
Label = Me.Range("LabelName").value
If Not IsMissing(Title) Then
docapp.Selection.InsertCaption Label:=Label, Title:=": " + Title
End If
+2表示尝试,-1表示过早寻求帮助=D