我有几个200多页的技术文档,我想要扫描,复制图像/图形,并粘贴到单独的Excel标签中,每个图像/图形一个。有没有办法用VBA或者像R?这样的脚本语言来做到这一点?
道歉,如果这与其他问题有些重复。但是,我没有看到重新复制图像的具体问题。谢谢!
答案 0 :(得分:1)
您可以通过编写一个简短的VBA宏来解决这个问题,该宏迭代所有(内联)图像,将它们复制到剪贴板,然后将每个图像粘贴到Excel中的新工作表中:
Sub CopyPicturesToExcel()
Dim oExcel As Excel.Application
Dim oWorkbook As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oInlineShape As inlineShape
Set oExcel = New Excel.Application
oExcel.Visible = True
Set oWorkbook = oExcel.Workbooks.Add
For Each oInlineShape In ActiveDocument.InlineShapes
oInlineShape.Range.Copy
Set oSheet = oWorkbook.Sheets.Add(After:=oWorkbook.Sheets(oWorkbook.Sheets.Count))
oSheet.Paste
Next
' remove the empty first sheet
oWorkbook.Sheets(1).Delete
End Sub