AnsweredAssumed Answered

Do something to cutlist 'FirstFeature' - VBA

Question asked by Raymond Yau on Sep 4, 2017
Latest reply on Sep 5, 2017 by Deepak Gupta

Hi,

 

I'm having some trouble getting the logic right on a macro I have. The macro currently performs a function to each and every item in the cutlist. Something like:

 

Set swFeat = swModel.FirstFeature

Do While Not swFeat is Nothing
//set some variables
     If swFeat.GetTypeName = "CutListFolder" Then
          //Do something i.e. get cutlist properties
     End If
set swFeat = swFeat.GetNextFeature
loop


 

But what if I wanted to perform an action only to the first item on the cutlist before the Do While loop? I tried to perform a function only to the first item on the list by adding the function outside the loop but for some reason, it doesn't get/select the first item on the list.

 

Set swFeat = swModel.FirstFeature

If Not swFeat Is Nothing Then
//Do something i.e add new property to first cutlist item 
//Debug.print new property
End If

Do While Not swFeat is Nothing
//set other variables
     If swFeat.GetTypeName = "CutListFolder" Then
          //Do something i.e. get all cutlist properties
     End If
set swFeat = swFeat.GetNextFeature
loop

 

Sorry if its a bit vague, I'll update this with more info if it's not clear enough.

Outcomes