尝试从 Access 2013 到 Outlook 2013 发送电子邮件时随机发生的错误(48,加载 DLL 时出错)



我目前正在开发一个Access 2013数据库。在其中一个表单上,我有一个按钮,用于收集信息,然后将其放入Outlook 2013电子邮件中并发送。代码本身有效,但有时(我无法预测何时(我收到一个错误,内容为"运行时错误'48',加载 DLL 时出错"。一旦发生这种情况,我必须重新启动计算机才能使按钮再次工作。 我只使用 VBA 工作了几个星期,并没有找到解决此问题的方法。

- 该程序(它是一个拆分数据库(所在的计算机同时具有Office 2010和2013。 我不知道这是否导致了问题,但是我对它们同时在PC上时会发生什么知之甚少,无法排除它。

- 此问题发生在程序的 .accde 和 .accdb 版本上

以下是发生错误时调试器显示的内容

'below is the code for the button that sends the email
Public Sub Command239_Click()
Dim oApp As Outlook.Application
Dim oMail As MailItem
Dim db As Database
'there is code a bunch of code between here that does not 
'relate to sending the email
'accessing outlook
Set oApp = CreateObject("Outlook.application")
Set oMail = oApp.CreateItem(olMailItem)      ' <<<<<<<<<<< this line is highlighted in yellow    >>>>>>>>>>>>>>       
'this is for the body of the email.
'things in quotes are text
'& between variables text and newlines
'type the variable to write its value
'vbCrLF goes to the next line
oMail.Body = "Incident Log: " & clsORopen & ", " & Lgst & ", " & Tme & vbCrLf & Division & ": " & Location & ", " & secLocation & vbCrLf & "Circuit/Apparatus: " & Circuit & vbCrLf & "Caused by: " & cause & ", " & rtcause & vbCrLf & vbCrLf & Disturbance & vbCrLf & vbCrLf & "Person Notified: " & Notified & vbCrLf & "Returned to Normal: " & Returned & vbCrLf & "User: " & getusername & " Date: " & Format(Now, "MMM,d,yyyy")
'the subject
oMail.Subject = Division & " - " & Tyype & ", " & Circuit
'sending to these people
oMail.To = emaillist
oMail.Send
Set oMail = Nothing
Set oApp = Nothing

在具有 64 位 Office 的 32 位 Windows 上似乎是一个问题。一个建议的解决方案: http://support.mccpilotlog.net/support/solutions/articles/9864-windows-pc-run-time-error-48-error-loading-dll

更多信息在这里: https://www.experts-exchange.com/questions/29012275/MS-Access-Run-time-error-48-Error-Loading-dll-after-upgrading-from-2013-64-bit-to-2016.html

最新更新