CodexBloom - Programming Q&A Platform

VBA to Send Emails via Outlook scenarios with 'Run-time scenarios '-2147467259 (80004005)'

👀 Views: 0 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-14
vba outlook email

I've looked through the documentation and I'm still confused about I need help solving This might be a silly question, but I'm trying to automate sending emails from Excel using VBA and I'm working with a frustrating scenario... The code works perfectly on my development machine, but when I run it on a different machine, I receive a 'Run-time behavior '-2147467259 (80004005)'' without any further explanation. Here's the relevant part of my code: ```vba Sub SendEmail() Dim OutlookApp As Object Dim OutlookMail As Object Set OutlookApp = CreateObject("Outlook.Application") Set OutlookMail = OutlookApp.CreateItem(0) With OutlookMail .To = "recipient@example.com" .Subject = "Test Subject" .Body = "This is a test email sent from Excel using VBA." .Send End With Set OutlookMail = Nothing Set OutlookApp = Nothing End Sub ``` I've checked that Outlook is installed on the other machine and that the email address is correct. I've also ensured that the appropriate references are set in the VBA editor. I've tried running the Excel application as an administrator and checked the security settings in Outlook, but nothing seems to change the outcome. If I comment out the `.Send` line and instead use `.Display`, the email opens correctly in Outlook, which suggests that the scenario lies specifically with the sending action. Could there be configuration differences between the two machines that might cause this behavior? Any insights would be greatly appreciated! My team is using Vba for this desktop app. Any help would be greatly appreciated! This issue appeared after updating to Vba 3.11. I'd be grateful for any help. This issue appeared after updating to Vba 3.10. Any advice would be much appreciated. This is my first time working with Vba LTS.