我有一个简短的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