Senhores,
Estou com um erro ao acionar um botão no access para executar um scripting SAP ECC:
Primeiramente algumas informações. O que é SAP?
http://pt.wikipedia.org/wiki/SAP_ERP
O erro está na linha:
session.findById("wnd[0]").MaximizeOnde o access retorna a mensagem que o objeto é obrigatório.
Meu código está como segue:
Private Sub Comando10_Click()
If Not IsObject(SAPapplication) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPapplication = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(SAPconnection) Then
Set SAPconnection = SAPapplication.Children(0)
End If
If Not IsObject(SAPsession) Then
Set SAPsession = SAPconnection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject SAPsession, "on"
WScript.ConnectObject Application, "on"
End If
Set SAPsession = Nothing
Set SAPconnection = Nothing
Set SapGuiAuto = Nothing
session.findById("wnd[0]").Maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "f-51"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtBKPF-BLDAT").Text = "150513"
session.findById("wnd[0]/usr/txtBKPF-XBLNR").Text = "124"
session.findById("wnd[0]/usr/txtRF05A-AUGTX").Text = "teste lancamento votorantim"
session.findById("wnd[0]/usr/ctxtRF05A-NEWBS").Text = "31"
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").Text = "100924"
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").SetFocus
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").caretPosition = 6
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtBSEG-WRBTR").Text = "1000,00"
session.findById("wnd[0]/usr/ctxtBSEG-BUPLA").Text = "0004"
session.findById("wnd[0]/usr/ctxtRF05A-NEWBS").Text = "21"
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").Text = "100924"
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").SetFocus
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").caretPosition = 6
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtBSEG-WRBTR").Text = "1000,00"
session.findById("wnd[0]/usr/ctxtBSEG-BUPLA").Text = "0004"
session.findById("wnd[0]/usr/ctxtBSEG-SGTXT").Text = "arredondamento cod barras boleto"
session.findById("wnd[0]/usr/ctxtBSEG-SGTXT").SetFocus
session.findById("wnd[0]/usr/ctxtBSEG-SGTXT").caretPosition = 32
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[11]").press
End Sub
Estou com um erro ao acionar um botão no access para executar um scripting SAP ECC:
Primeiramente algumas informações. O que é SAP?
http://pt.wikipedia.org/wiki/SAP_ERP
O erro está na linha:
session.findById("wnd[0]").MaximizeOnde o access retorna a mensagem que o objeto é obrigatório.
Meu código está como segue:
Private Sub Comando10_Click()
If Not IsObject(SAPapplication) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPapplication = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(SAPconnection) Then
Set SAPconnection = SAPapplication.Children(0)
End If
If Not IsObject(SAPsession) Then
Set SAPsession = SAPconnection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject SAPsession, "on"
WScript.ConnectObject Application, "on"
End If
Set SAPsession = Nothing
Set SAPconnection = Nothing
Set SapGuiAuto = Nothing
session.findById("wnd[0]").Maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "f-51"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtBKPF-BLDAT").Text = "150513"
session.findById("wnd[0]/usr/txtBKPF-XBLNR").Text = "124"
session.findById("wnd[0]/usr/txtRF05A-AUGTX").Text = "teste lancamento votorantim"
session.findById("wnd[0]/usr/ctxtRF05A-NEWBS").Text = "31"
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").Text = "100924"
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").SetFocus
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").caretPosition = 6
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtBSEG-WRBTR").Text = "1000,00"
session.findById("wnd[0]/usr/ctxtBSEG-BUPLA").Text = "0004"
session.findById("wnd[0]/usr/ctxtRF05A-NEWBS").Text = "21"
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").Text = "100924"
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").SetFocus
session.findById("wnd[0]/usr/ctxtRF05A-NEWKO").caretPosition = 6
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtBSEG-WRBTR").Text = "1000,00"
session.findById("wnd[0]/usr/ctxtBSEG-BUPLA").Text = "0004"
session.findById("wnd[0]/usr/ctxtBSEG-SGTXT").Text = "arredondamento cod barras boleto"
session.findById("wnd[0]/usr/ctxtBSEG-SGTXT").SetFocus
session.findById("wnd[0]/usr/ctxtBSEG-SGTXT").caretPosition = 32
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[11]").press
End Sub