EBDN - Community - Question & Answers

  Tuesday, 27 August 2024
  9 Replies
  454 Visits
0
Votes
Undo
Hi All,

I'm developing a function to copy and paste the objectitem and connection selected in the drawing using the [ExecuteSheetOperation].

In some drawings, it works fine,

But, when I paste many objectitems into a sheet or a complicated,
the objects are pasted as temporary data that had not been created, as shown in the attached picture.

Can anyone tell me if this is a bug in the FromClipBoard feature or if the code is problematic?

Below is the code I used.

##############################################################################
Public Sub PasteFromClipBoard()

Dim oSheet As Sheet


Set oSheet = ActiveSheet
oSheet.Activate
Call FromClip(oSheet)

End Sub
Public Sub FromClip(oSheet As Sheet)

Dim atParamData(1 To 2) As Aucotec.AucExecuteSheetOperationRecord

On Error Resume Next

atParamData(1).qual = aucOpExecSelectionFromClipboard

atParamData(2).qual = aucArgExecSheetFctSel

atParamData(2).Val = iCOPY_OPTION_NEW '----1 / 'iCOPY_OPTION_MERGE '4

Call oSheet.ExecuteSheetOperation(atParamData)

Dim i As Integer

For i = 1 To 100
DoEvents
Next i

Call IsSheetAvailable(oSheet)

End Sub
Private Sub IsSheetAvailable(oSheet As Sheet)

Dim bNext As Boolean
Dim i As Integer
ReDim arNext(0) As AucExecuteSheetOperationRecord
Dim eResult As AucDrawingClientState

bNext = False

Do Until bNext = True

ReDim arNext(1)
arNext(1).qual = aucOpExecIsNextSheetOperationPossible

Call oSheet.ExecuteSheetOperation(arNext)
eResult = arNext(1).Val

For i = 1 To 100
DoEvents
Next i

If eResult = aucOK Then
bNext = True
End If
Loop

If bNext = True Then
Exit Sub
End If

End Sub