Split selected items
Split selected items
(OP)
THis is waht I am doing to copy and paste bodies
Selection1 = Call obj1.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS ", False, 2, True)
‘then I select more than 2 (say for example i.Body1 ii. Body2 )
selection1.Copy
‘when I paste
Call selection1.PasteSpecial("CATPrtResultWithOutLink") ‘ all bodies gets pasted at a time
‘WHAT I AM LOOKING DO IS THAT WHEN I PASTE
‘first i) Body1 to get pasted…….. ( Can I use some thing like Selection1.item(1) to get pasted)
‘After some operations
‘ii) Body2 to get pasted
How can I split items from array selected elements and paste when ever I require one ?
Selection1 = Call obj1.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS ", False, 2, True)
‘then I select more than 2 (say for example i.Body1 ii. Body2 )
selection1.Copy
‘when I paste
Call selection1.PasteSpecial("CATPrtResultWithOutLink") ‘ all bodies gets pasted at a time
‘WHAT I AM LOOKING DO IS THAT WHEN I PASTE
‘first i) Body1 to get pasted…….. ( Can I use some thing like Selection1.item(1) to get pasted)
‘After some operations
‘ii) Body2 to get pasted
How can I split items from array selected elements and paste when ever I require one ?





RE: Split selected items
In VBA you can store them in a collection:
Dim cInputs as new collection
oSelection.Clear
'Use your code to manually select elements
'Loop through selection object and add to collection
For i = 1 to to oSelection.count
cInputs.add oSelection.item(i).Value
Next
oSelection.add cInputs.Item(1)
oSelection.copy
oSelection.clear
'Paste first item
'Code to work on first pasted item
oSelection.add cInputs.Item(2)
oSelection.copy
oSelection.clear
'Paste second item
'Code to work on second pasted item
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
If you are writing in vbscript you can add selected objects to an array:
Dim aInputs()
oSelection.Clear
'Use your code to manually select elements
'Loop through selection object and add to array
iSize = oSelection.count - 1
Redim aInputs(iSize)
For i = 1 to to oSelection.count
aInputs(i-1) = oSelection.Item(i).Value
Next
oSelection.add aInputs.Item(0)
oSelection.copy
oSelection.clear
'Paste first item
'Code to work on first pasted item
oSelection.add cInputs.Item(1)
oSelection.copy
oSelection.clear
'Paste second item
'Code to work on second pasted item