0

When I click the Next button on the form I would like to get the next part on the Form I have a for loop that goes through Product Tree and reads PartName in variable oForm.txtPartName. On oForm there is a button Next and what it's supposed to do is break the for loop and jump on the next part on the tree. What code should I put into the Next button to get the job done?

For i = 1 To oProducts.Count
       
    On Error Resume Next
    Set oPartDoc = oProducts.Item(i).ReferenceProduct.Parent
    
    Set oPart = oPartDoc.part
    
        If CInt(Mid(oPart.Name, 26, 3)) > 100 Then

        oForm1.txtPartName = oPart.Name
        
        oForm1.Show

        End If
    Next i
codewario
  • 19,553
  • 20
  • 90
  • 159
That'sMe
  • 1
  • 1
  • 1
    Welcome to the board. There really isn't enough here to answer your question. Please review [How do I ask a good question](https://stackoverflow.com/help/how-to-ask). – Jamie Riis Sep 01 '18 at 22:46
  • It looks like the button is on a form inside excel, rather than some kind of HTML button on a web site. You already know what oProducts.Count is, right. Can't you just use that number to move the process forward. Something like Application.Run Activesheet.Shapes(1).OnAction or CommandButtonNext_Click. I think that should do it. – ASH Sep 02 '18 at 13:20

0 Answers0