diff --git a/handler.bas b/handler.bas index 81d94fd..bf08f60 100644 --- a/handler.bas +++ b/handler.bas @@ -198,7 +198,7 @@ End Sub -Function request_adjust(doc As String) As Object +Function request_adjust(doc As String, ByRef fail As Boolean) As Object Dim req As New WinHttp.WinHttpRequest Dim json As Object @@ -221,11 +221,19 @@ Function request_adjust(doc As String) As Object If Mid(wr, 2, 5) = "error" Then MsgBox (wr) + fail = True Exit Function End If If Mid(wr, 1, 6) = "" Then MsgBox (wr) + fail = True + Exit Function + End If + + If Mid(wr, 1, 6) = " "" Then - Call handler.request_adjust(Sheets("_month").Cells(i, 16)) - End If - Next i + If Me.newpart Then + Call handler.request_adjust(Sheets("_month").Cells(2, 16), fail) + If fail Then Exit Sub + Else + For i = 2 To 13 + If Sheets("_month").Cells(i, 16) <> "" Then + Call handler.request_adjust(Sheets("_month").Cells(i, 16), fail) + If fail Then Exit Sub + End If + Next i + End If Sheets("Orders").Select Worksheets("month").Visible = xlHidden