Witam
Mam problem z pętlą w VBA która nie chce się zakończyć. Chyba wiem o co chodzi. Mianowicie jako max krok zadałem zmienną ID pobieraną jako CDbl z innego okna dialogowego. Jak zadałem komendę msgbox by wyswietliła wartość zmiennej ID to wyszło nic. Poniżej przedstawiam kod. To jest macro w Inventorze i VBA działa tu troszke inaczej. Czy mógłbym liczyc na pomoc jak poprawnie pobrac daną ID by w pętli działała poprawnie i była widoczna. Z góry dzięki za pomoc.
Private Sub CommandButton1_Click()
Dim LD As Double
Dim ID As String
Dim HP As Double
Dim HO As Double
Dim HN As Double
Dim SS As Double
Dim GS As Double
Dim S1 As Double
Dim S2 As Double
Dim HD As Double
LD = CDbl(txtIDod.Text)
ID = CDbl(UserForm3.txtID.Text)
HP = CDbl(UserForm2.txtA.Text)
S1 = CDbl(UserForm2.txtF.Text)
S2 = CDbl(UserForm2.txtG.Text)
SS = CDbl(UserForm2.txtD.Text)
HD = CDbl(UserForm2.txtH.Text)
Dim oCompDef As PartComponentDefinition
Set oCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oSketch6 As PlanarSketch
Set oSketch6 = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(2))
Dim oTransGeom2 As TransientGeometry
Set oTransGeom2 = ThisApplication.TransientGeometry
Dim i As Integer
For i = 0 To ID Step 1
i = i + 1
Dim oRect6 As SketchEntitiesEnumerator
Set oRect6 = oSketch6.SketchLines.AddAsTwoPointRectangle(oTransGeom2.CreatePoint2d(-150 - S1, HP + LD), oTransGeom2.CreatePoint2d(-SS - 150 + S2, HP + HD + LD))
Next i
Dim oProf6 As Profile
Set oProf6 = oSketch6.Profiles.AddForSolid
Dim oExtru6 As ExtrudeFeature
Set oExtru6 = oCompDef.Features.ExtrudeFeatures.AddByDistanceExtent(oProf6, 150, kPositiveExtentDirection, kCutOperation)
End Sub