问题
I'm trying to copy all shapes in a visio page and paste it in Excel as an image. The image should be a close replica of the visio drawing. Looking for Excel vba script to do this. I'm able to open visio, access shapes information etc, but stuck in copying and pasting all shapes to excel as a single image
I tried the following:
For j = 1 To intShapeCount 'Get count of shapes on page
Set vsoConnectFrom = vsoShapes.Item(j)
vsoConnectFrom.Copy(visCopyPasteNoTranslate)
CIwb.Worksheets("Current FlowChart").Paste
Next j
This code is pasting all shapes to a single spot and the shapes are not connected. Hence looking for code that would just copy all shapes and paste as image into excel
回答1:
'Assuming your page object is named vsoPage
'This embeds the visio drawing
vsoPage.CreateSelection(visSelTypeAll).Copy
CIwb.Worksheets("Current FlowChart").Paste
来源:https://stackoverflow.com/questions/56265048/copying-a-visio-page-and-pasting-it-in-excel-as-an-image