'How to copy objects from a VISIO file to the same location in another file
I created a VBA program to copy from one VISIO file (A.vsdx) to another VISIO file (B.vsdx) using the Selection.Copy method.
I want to copy it to the same location as the A.vsdx file, but it doesn't work. It was https://docs.microsoft.com/en-us/office/vba/api/visio.page.paste Looking at this page, visCopyPasteNoTranslate seems to be good, but it didn't work as expected.
Alternatively, I considered using the Selection.Top method, but it didn't work because VISIO's Selection doesn't have a Top or Left method.
The pseudo code is shown below.
Dim group_ As visio.Shape
For Each vsoPage In vsoDoc.Pages
vsoWindow_old.Page = vsoDoc.Pages.ItemU(vsoPage.NameU)
vsoWindow_new.Page = newvsoDoc.Pages.ItemU(vsoPage.NameU)
For Each vsoShape In vsoPage.Shapes
vsoWindow_old.Selection.Select vsoShape, visSelect
Next vsoShape
If Not (vsoWindow_old.Selection Is Nothing) Then
''' This code doesn't work
Set group_ = vsoWindow_old.Selection.group
'''
vsoWindow_old.Selection.Copy
newvsoDoc.Pages.Item(vsoPage.Name).Paste visCopyPasteNoTranslate
End If
vsoWindow_old.Selection.DeselectAll
Next vsoPage
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
