程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了添加 Outlook 库以访问 VBA 阻止 SAP createsession 工作大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决添加 Outlook 库以访问 VBA 阻止 SAP createsession 工作?

开发过程中遇到添加 Outlook 库以访问 VBA 阻止 SAP createsession 工作的问题如何解决?下面主要结合日常开发的经验,给出你关于添加 Outlook 库以访问 VBA 阻止 SAP createsession 工作的解决方法建议,希望对你解决添加 Outlook 库以访问 VBA 阻止 SAP createsession 工作有所启发或帮助;

SAP GUI 代码 CreateSession 当我添加 Microsoft Outlook 16.0 对象库时,永远不会创建会话。如果我删除了 Outlook 引用,它就可以正常工作。

outlook 代码位于另一种表单上,此表单的用户不使用,因此不会执行。

由于这个问题是在 2010 年在 SAP 网站上于 2010 年发现的,没有其他问题,我将假设它的编写方式是这样的

我正在使用 SAP GUI 脚本 API

@H_238_2@microsoft Outlook 16.0 对象库

SAP 版本为 7.50

谢谢

彼得

Session_number_max = 5                                  'the maximum number of possible SAP sessions
Dim session_number_(5)
 On Error Resume Next
Set SapGuiauto = Getobject("SAPGUI")
Set SAP = SapGuiauto.GetScripTingENGIne
Set Connection = SAP.Children(0)
Set session = Connection.Children(0)
'------------------------------------------- new session connect -------------------------------------------------------------
session_number_all = Connection.Children.Count - 1
If Connection.Children.Count = 0 Then
 'MsgBox ("Couts =") & session_number_all
 'GoTo Erreur
 End If
For i = 0 To Session_number_max - 1
     session_number_(i) = 0
Next
For session_number = 0 To session_number_all
     Set session = Connection.Children(Int(session_number))
     session_number_(session.Info.Sessionnumber) = session.Info.Sessionnumber
Next
If session_number_all < Session_number_max - 1 Then
      Do
trycount = trycount + 1

      
     session.CreateSession                                              '#### this ends up in an infinite loop as CreateSession never creates a valID session.  ####
 'WScript.sleep 500
      If Connection.Children.Count - session_number_all >= 2 Then Exit Do   '#### this ends up in an infinite loop as 
     
If trycount >5 then 

exit loop

GoTo Errorcode

end if
Loop
     On Error Resume Next
     Error_number = 1
     For session_number = 0 To session_number_all + 1
          Err.Clear
          Set session = Connection.Children(Int(session_number + 1))
          If Err.number > 0 Or Err.number < 0 Then Exit For
      'MsgBox (" Session = ") & session_number
         If session_number_(session.Info.Sessionnumber) = 0 Then
            Error_number = 0
            Exit For
         End If
         'session.findByID("wnd[0]").iconify                          'So you can send another SAP session in the task bar.
     Next
     On Error GoTo 0
Else
 MsgBox "Nouvelle session pas possible!"
End If

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的添加 Outlook 库以访问 VBA 阻止 SAP createsession 工作全部内容,希望文章能够帮你解决添加 Outlook 库以访问 VBA 阻止 SAP createsession 工作所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。