Share via

VBA macro not generating Emails.

Anonymous
2024-01-10T12:01:22+00:00

Hi There, Jyoti Here,  I have Microsoft office  LTSC Professional Plus 2021 on Windows 11. I can see My Microsoft Outlook Emails. I cant see Outlook.exe file even after installing outlook.I have written VBA macro to send mail from outlook to my gmail or outlook a/c. Its giving Error at 'Set OutlookApp = CreateObject("Outlook.Application")' this command.When I checked Reference in VBA Tool, I could not locate Microsoft Office Outlook object. I could see 'Microsoft Office 16.0 Object Library', OLE automation.Kindly Suggest how to bring Microsoft Office Outlook Object in VBA - Tool-reference. I need to deliver the code earliest.Waiting for quick response.Regards,Jyot

Outlook | Windows | New Outlook for Windows | For business

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-01-10T13:36:09+00:00

    Hi, I'm Diane and I'm happy to help you today.

    This is an Outlook macro? If not, which office app is running the macro?

    Is Outlook open when the macro runs? If so, you don't need to use createobject.

    This will work if its an Outlook macro: Dim OutlookApp As Outlook.Application Set OutlookApp = Application

    If you are running it from another office app, try this

    Dim blnCreated As Boolean

    Set OutlookApp = GetObject(, "Outlook.Application") If Err.Number <> 0 Then Set OutlookApp = CreateObject("Outlook.Application") blnCreated = True Err.Clear Else blnCreated = False End If

    Let me know how it goes, I'm here to help you further if needed.

    -- Diane

    Was this answer helpful?

    0 comments No comments