diff --git a/Master Template.xlsm b/Master Template.xlsm index ac435d5..61d0378 100644 Binary files a/Master Template.xlsm and b/Master Template.xlsm differ diff --git a/VBA/build.frx b/VBA/build.frx index 02af97b..162ee8e 100644 Binary files a/VBA/build.frx and b/VBA/build.frx differ diff --git a/VBA/changes.frx b/VBA/changes.frx index 7fc051a..2d32257 100644 Binary files a/VBA/changes.frx and b/VBA/changes.frx differ diff --git a/VBA/fpvt.frm b/VBA/fpvt.frm index 46a254c..e4fef29 100644 --- a/VBA/fpvt.frm +++ b/VBA/fpvt.frm @@ -59,9 +59,8 @@ Private Sub butAdjust_Click() Exit Sub End If - Call handler.request_adjust(tbAPI.text, fail) - If fail Then - MsgBox "Adjustment was not made due to error.", vbOKOnly Or vbExclamation + If Not handler.request_adjust(tbAPI.text, msg) Then + MsgBox msg, vbOKOnly Or vbExclamation, "Adjustment was not made due to error." Exit Sub End If diff --git a/VBA/fpvt.frx b/VBA/fpvt.frx index bf8b47d..1238255 100644 Binary files a/VBA/fpvt.frx and b/VBA/fpvt.frx differ diff --git a/VBA/handler.bas b/VBA/handler.bas index 2df22ff..b2e95e9 100644 --- a/VBA/handler.bas +++ b/VBA/handler.bas @@ -229,7 +229,7 @@ End Sub -Function request_adjust(doc As String, ByRef fail As Boolean) As Object +Function request_adjust(doc As String, ByRef msg As String) As Boolean Dim req As New WinHttp.WinHttpRequest Dim json As Object @@ -238,8 +238,10 @@ Function request_adjust(doc As String, ByRef fail As Boolean) As Object Dim j As Long Dim str() As String + request_adjust = False + If doc = "" Then - fail = True + msg = "No data was given to be processed." Exit Function End If @@ -263,35 +265,23 @@ Function request_adjust(doc As String, ByRef fail As Boolean) As Object Debug.Print Timer - t; "sec): "; Left(wr, 200) End With - 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) = "" Or _ + Mid(wr, 1, 6) = " "" Then Set adjust = JsonConverter.ParseJson(shMonthUpdate.Cells(i, 16)) adjust("message") = shMonthView.Range("MonthComment").Value adjust("tag") = shMonthView.Range("MonthTag").Value jdoc = JsonConverter.ConvertToJson(adjust) - Call handler.request_adjust(jdoc, fail) - If fail Then Exit Sub + If Not handler.request_adjust(jdoc, msg) Then + Dim period As String + period = Format(i - 1, "00") & " - " & Format(DateSerial(2000, (i - 1) + 5, 1), "mmm") + allMsg = IIf(allMsg = "", "", vbNewLine) & period & ": " & msg + End If End If Next i + + If allMsg <> "" Then MsgBox allMsg, vbOKOnly Or vbCritical, "Problems Loading Adjustments" End If shOrders.Select