Hello,
I am looking to create a macro that copies and pastes an item from one document to the other. The problem I am having is having the user select their active window. Right now the code specifies which document to paste in. I am looking for code that prompts the user to select their window they want it to be pasted in.
Thanks
Sub CATMain()
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Open("Test Model")
Set partDocument1 = CATIA.ActiveDocument
Dim selection1 As Selection
Set selection1 = partDocument1.Selection
selection1.Clear
Dim part1 As Part
Set part1 = partDocument1.Part
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("Subdivisions")
Dim hybridShapes1 As HybridShapes
Set hybridShapes1 = hybridBody1.HybridShapes
Dim hybridShapeThickness1 As HybridShapeThickness
Set hybridShapeThickness1 = hybridShapes1.Item("Test Surface")
selection1.Add hybridShapeThickness1
selection1.Copy
Dim windows1 As Windows
Set windows1 = CATIA.Windows
Dim specsAndGeomWindow1 As SpecsAndGeomWindow
Set specsAndGeomWindow1 = windows1.Item("PART1")
specsAndGeomWindow1.Activate
Dim partDocument2 As PartDocument
Set partDocument2 = CATIA.ActiveDocument
Dim selection2 As Selection
Set selection2 = partDocument2.Selection
selection2.Clear
Dim part2 As Part
Set part2 = partDocument2.Part
selection2.Add part2
selection2.Paste