Copy Sheet macro doesn't work with crop

Copy Sheet macro doesn't work with crop

jani_karjalainenJFQAG
Participant Participant
189 Views
1 Reply
Message 1 of 2

Copy Sheet macro doesn't work with crop

jani_karjalainenJFQAG
Participant
Participant

Hello,

 

I'm using vba macro to copy sheets, but for some reason if I have cropped views in sheet then I get this error or Inventor just crashes.

 

Any ideas why this is happens?

 

jani_karjalainenJFQAG_0-1681470509732.png

Copy sheet macro:

Sub Sheet_Kopio()

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim tmpDoc As DrawingDocument
Set tmpDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, , True)
Dim newSheet As Sheet
Set newSheet = oDoc.ActiveSheet.CopyTo(tmpDoc)
Call newSheet.CopyTo(oDoc)
tmpDoc.Close (True)

End Sub

 

 

0 Likes
190 Views
1 Reply
Reply (1)
Message 2 of 2

Rich-T
Advocate
Advocate

No problems for me using the code above.

I'm using 2021.3.1

0 Likes