Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split selected items

Status
Not open for further replies.

appvid

Automotive
Nov 9, 2012
81
US
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 ?
 
Replies continue below

Recommended for you

Instead of copying, you need to store your selected items. You should always post the language you are working in too. You can do something like this:

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top