I'm looking for an event triggered by changing a document header field (eg change the exchange), this all in VBA in Spring version 9.
The final idea is when changing the value of the exchange in the header to update all lines with the new change.
I'm looking for an event triggered by changing a document header field (eg change the exchange), this all in VBA in Spring version 9.
The final idea is when changing the value of the exchange in the header to update all lines with the new change.
In version 9, at the header level, you only have 2 events in VBA:
EditorVendas_TipoDocumentoIdentificado
EditorVendas_ClienteIdentificado
In version 10 this will already be different and there will be other possibilities.
There is no native event that allows you to invoke methods by changing a value in the header, except for, as well as @ManuelQuelhas, TipoDocumentoIdentificado
and ClienteIdentificado
.
However, there is the TeclaPressionada
method, which allows, at any time, with the press of a button to evoke code in VBA. Having said this, perhaps the ideal would be to implement a method to recall from a key or key combination ( SHIFT
or CTRL
+ key).
Example:
Private Sub EditorVendas_TeclaPressionada(KeyCode As Integer, Shift As Integer)
Dim objLinhaVenda As GcpBELinhaDocumentoVenda
On Error GoTo Erro
If KeyCode = vbKeyF3 And Me.DocumentoVenda.Linhas.NumItens > 0 Then
For Each objLinhaVenda In Me.DocumentoVenda.Linhas
'o teu código aqui
'...
Next
End If
Set objLinhaVenda = Nothing
Exit Sub
Erro:
PlataformaPRIMAVERA.Dialogos.MostraErro Err.Description, PRI_Exclama
End Sub