You may try this also.
Dim Inv As SAPbobsCOM.Documents
Inv = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
With Inv
If .GetByKey("1") Then
Inv.PaymentMethod = "30D"
If Not .Update = 0 Then
MsgBox(oCompany.GetLastErrorDescription)
End If
End If
End With
You can't update paid invoice or closed.