[VBA ] VB转VBA ReDim Preserve 问题

楼主: noworneverev (小朋友)   2017-05-20 12:16:46
我有一段VB的程式码想转成VBA遇到一点困难
VB的程式码如下:
'Group the line and the textbox
Dim MidObj() As Object
ReDim Preserve MidObj(2)
MidObj(0) = shapeBeg.Name
MidObj(1) = connector1.Name
app.ActiveSheet.Shapes.Range(MidObj).Group()
目的是要群组一个线条跟一个文字方块,这个是正确的
VBA现在我写的是:
ReDim Preserve MidObj(2)
MidObj(0) = GroupShapeBeg1
MidObj(1) = GroupShapeBeg2
ActiveSheet.Shapes.Range(Array(GroupShapeBeg1, GroupShapeBeg2)).Select
Selection.ShapeRange.Group.Select
我的想法是把原本shapeBeg.Name、connector1.Name在VBA里先分别宣告给
GroupShapeBeg1与GroupShapeBeg2,再把它们群组起来,可是没有作用QQ
请求大大帮忙看看哪里有问题,谢谢

Links booklink

Contact Us: admin [ a t ] ucptt.com