是什么导致了这个 CorelDraw VBA 宏不匹配错误?

What is causing this CorelDraw VBA Macro Mismatch Error?

我有一个简短的 Excel VBA 宏,它获取(打开的)CorelDraw 绘图中的当前选择并移动它。当我将 OrigSelection 设置为 app.ActiveSelectionRange 时,为什么会出现不匹配运行时错误?这是我的代码:

Private Sub MoveAndResizeSelection()
    Dim app As CorelDraw.Application
    Set app = CorelDraw.Application
    Dim OrigSelection As ShapeRange
    Set OrigSelection = app.ActiveSelectionRange
    
    'Move and Resize the selection
    OrigSelection.Move 2.595, -6.751
    
End Sub

我正在使用 Excel Office 16 和 CorelDraw Graphics Suite 2022。

罪魁祸首是

Dim OrigSelection As ShapeRange

这是隐含的

Dim OrigSelection As Excel.ShapeRange

改为

Dim OrigSelection As CorelDraw.ShapeRange