I have to write a macro that runs when I select the PFD sheet from an active project. The system should copy and paste into a new sheet under the same folder and merge. For now the PFD sheet has a mechanical tag. This mechanical tag should merge into P&ID when the macro is run.
The macro works, it copied and paste another sheet but still the device are not merged into the copied sheet. Below is the code:
Public Sub test5()
Dim oSheet As Sheet
Dim oObjectItem As ObjectItem
Dim oCopy As ObjectItem
Set oObjectItem =
Application.Selection(1)
Set oSheet = oObjectItem
Set oCopy = oSheet.CopyTo2(oSheet.Parent, True, True, True, aucCopyTSimple)
End Sub