I have created a script to rename objects in CorelDraw according to alphabetical order. This script should work as expected, but I don t know why the sequence is from Z to A. Screenshots on the left show the code functioning as intended.
Sub RenameSelectedObjects()
Dim i As Integer
Const START_CHAR = 65 ASCII untuk A
Const END_CHAR = 90 ASCII untuk Z
Dim objCount As Integer
Dim selectedShape As Shape
i = 0
objCount = ActiveSelectionRange.Count
For Each selectedShape In ActiveSelectionRange
If i > END_CHAR - START_CHAR Then Exit Sub
selectedShape.Name = Chr(START_CHAR + i)
i = i + 1
Next selectedShape
End Sub
但是,如果整个目标都用这一文字成功的话,这又是一个问题。
Sub RenameObjects()
Dim i As Integer
Const START_CHAR = 65 ASCII untuk A
Const END_CHAR = 90 ASCII untuk Z
i = 0
For Each s In ActivePage.Shapes.All
If i > END_CHAR - START_CHAR Then Exit Sub
s.Name = Chr(START_CHAR + i)
i = i + 1
Next s
End Sub
是否有任何人能够协助我只就选定的物体开展工作,并维持从A到Z的次序?