HenryCam
5th September 2012, 20:49
Buen Dia a Todos:

Alguien me podria ayudar con el codigo para abrir una sesion de baan V atravez de codigo VBA para Excel, traté de adaptar el siguiente codigo para BaanIV pero no tuve suerte

mi version de baan es 7.1d.04.156

saludos y espero me puedan ayudar. :)



Private Sub CommandButton1_Click()

Set BaanObj = CreateObject("Baan4.Application")
BaanObj.Timeout = 10
On Error GoTo BaanAutomationError

B_function = "start.session(" & Chr(34) & "tiitm0101m000" & Chr(34) & ")"
BaanObj.ParseExecFunction "otccomdllbaan", B_function
Exit Sub

' error handling

BaanAutomationError:
MsgBox "Baan IV automation error: " & BaanObj.Error
MsgBox "Return value function: " & B_function & " " & BaanObj.ReturnValue
BaanObj.Quit
Set BaanObj = Nothing
Exit Sub

End Sub

vahdani
6th September 2012, 11:32
Hola,

this works for me. Also take a look at this thread about otccomdllbaan (http://www.baanboard.com/baanboard/showthread.php?t=14763&highlight=otccomdllbaan)

PS: "Baan.Application.360Baan5Demo" is my class name! For your Class name take a look at the BW-Profile Configuration (See attachment). I think you can also use "Baan.Application" if you have only one Profile.

PPS: There is no session tiitm0101m000 in baan V!


Sub Baan()
Set BaanObj = CreateObject("Baan.Application.360Baan5Demo")
BaanObj.Timeout = 10
On Error GoTo BaanAutomationError

B_function = "zoom.to.menu(" & Chr(34) & "tcmcs0145m000" & Chr(34) & _
",2," & Chr(34) & Chr(34) & "," & Chr(34) & Chr(34) & ",0,0)"
BaanObj.ParseExecFunction "ottstpstandard", B_function
Exit Sub

' error handling

BaanAutomationError:
MsgBox "Baan V automation error: " & BaanObj.Error
MsgBox "Return value function: " & B_function & " " & BaanObj.ReturnValue
BaanObj.Quit
Set BaanObj = Nothing
Exit Sub

End Sub


PS:

HenryCam
10th September 2012, 05:09
Hi Vadanhi

Hi Vadanhi

Really thanks for answer my request for help..I appreciate.. at this moment
I'm trying made work your code, but my excel shows the "Run-time Error 429,
Active X can't create Object" I'm tried to fix it.. once this error will disappeared it, I will
comment to you..

Thanks.

Henry