Good afternoon,
After saving a document to an "A" company, you need to create another one in automatic in company "B" and in this to perform the integration in accounting.
I'm having trouble connecting to Accounting. VBA Code:
Sub DocVendaGrupo()
Dim oMotor As New ErpBS
Dim Transacao As New StdBETransaccao
Dim docVenda As New GcpBEDocumentoVenda
‘Abre outra Empresa
oMotor.AbreEmpresaTrabalho tpEmpresarial, “ZGZ”, Aplicacao.Utilizador.Utilizador, Aplicacao.Utilizador.Password, Transacao, Instancia, True
‘Preenche Objeto DocVenda
docVenda.tipodoc = “FA”
docVenda.entidade = “C00588”
docVenda.tipoentidade = “C”
docVenda.CondPag = “1”
oMotor.Comercial.Vendas.PreencheDadosRelacionados docVenda, 5
oMotor.Comercial.Vendas.AdicionaLinha docVenda, “PA205107072.15.00”, 1
oMotor.Comercial.Vendas.Actualiza docVenda
Debug.Print docVenda.tipodoc & ” ” & docVenda.serie & ” ” & docVenda.numdoc & ” ” & oMotor.Contexto.CodEmp
oMotor.Comercial.LigacaoCBL.IntegraDocumentoLogCBL “V”, docVenda.tipodoc, docVenda.serie, docVenda.numdoc, docVenda.Filial
End Sub
In IntegraDocumentoLogCBL, the error occurs: "Object variable or With block variable not set"
The goal is to create the document and perform the integration in accounting in automatic in company "B".
Note: If you go to the VBA of company "B" and put in after saving the:
BSO.Comercial.LigacaoCBL.IntegraDocumentoLogCBL “V”, me.DocumentoVenda.tipodoc, me.DocumentoVenda.serie, me.DocumentoVenda.numdoc, me.DocumentoVenda.Filial
Integration into accounting is accomplished successfully.
Yours sincerely,
Vitor Ferreira