Not directly: Excel VBA’s traditional Outlook automation uses the Outlook COM object model, which New Outlook for Windows does not support. To create an email with an attachment from a macro, use classic Outlook if it is available, or use a different sending method such as Microsoft Graph or Power Automate.
Why New Outlook changes the answer
Many Excel email macros use Outlook automation: VBA asks Windows for an Outlook application object, creates a message, adds an attachment, and displays or sends the message. That approach depends on Outlook’s COM automation interface, also called the Outlook Object Model. Classic Outlook for Windows provides that interface. New Outlook for Windows does not provide the COM object model that these VBA macros require.
As a result, changing the default mail app to New Outlook does not make a classic Outlook macro compatible with it. A line such as CreateObject("Outlook.Application") is a request for the classic Outlook automation interface; it is not a general command that can control whichever mail app is currently open. If classic Outlook is not installed or available, the macro will commonly fail when it tries to create that object.
This is a limitation of the mail application’s automation interface, not of Excel’s ability to attach a file in principle. The workbook can still prepare the information, but the method used to authenticate and send mail has to be supported by the mail service. New Outlook’s interface and Excel VBA are separate technologies.
Create a draft with classic Outlook
If classic Outlook for Windows is installed and configured with the account you want to use, this late-bound macro creates a draft and attaches the workbook containing the macro. It uses .Display, so you can review the recipient, message, and attachment before sending. The example is for Windows desktop Excel and classic Outlook, not New Outlook.
Before running any macro, save a copy of the workbook: VBA changes cannot be undone with Ctrl+Z. Save the workbook to a location you can find, and make sure the intended account is set up in classic Outlook.
Option Explicit
Sub CreateEmailWithWorkbookAttachment()
Dim outlookApp As Object
Dim mail As Object
Dim attachmentPath As String
' Attach the saved workbook that contains this macro.
If Len(ThisWorkbook.Path) = 0 Then
MsgBox "Save the workbook before running this macro."
Exit Sub
End If
attachmentPath = ThisWorkbook.FullName
On Error GoTo AutomationError
Set outlookApp = CreateObject("Outlook.Application")
Set mail = outlookApp.CreateItem(0) ' 0 is an Outlook mail item.
With mail
.To = "recipient@example.com"
.Subject = "Monthly report"
.Body = "Hello," & vbCrLf & vbCrLf & _
"Please see the attached workbook." & vbCrLf
.Attachments.Add attachmentPath
.Display ' Review the draft; this does not send it.
End With
Set mail = Nothing
Set outlookApp = Nothing
Exit Sub
AutomationError:
MsgBox "Could not create the Outlook message. Check that classic Outlook is installed and configured. " & _
Err.Description
Set mail = Nothing
Set outlookApp = Nothing
End Sub
Late binding means the code declares Outlook objects as Object rather than requiring you to select an Outlook library reference in the VBA editor. The number zero passed to CreateItem represents an Outlook mail item. The recipient and subject are examples; replace them with your intended values. The .Body property creates plain text. For formatted email, classic Outlook supports an HTML body through its .HTMLBody property, but HTML content must be constructed carefully.
Choose the right attachment
The sample attaches the entire saved workbook, including its worksheets and any other content in the file. It does not attach only the currently selected sheet or a visible range. If the workbook contains confidential data, hidden sheets, or internal calculations, review the file before sending it.
To attach a separate file instead, replace the assignment to attachmentPath with its full path, for example C:\Reports\Summary.pdf. The file must exist and be accessible to the account running Excel. A macro can check the path before adding it; otherwise, an invalid path can cause an error at the attachment step. Avoid relying on a relative path unless the macro explicitly builds it from a known folder.
For a report that should contain only a worksheet or a selected range, first create a separate export file, such as a PDF or a copy of a worksheet, and attach that file. This makes the attachment’s contents explicit and reduces the chance of exposing unrelated workbook data. It also means the macro needs additional code to create and save the export before it prepares the email.
Display a draft or send automatically
Displaying the message is usually the safer starting point. It allows a person to verify the To field, account, subject, attachment, and message body. This matters especially when addresses or file paths are produced from worksheet values, since a wrong cell reference can send information to the wrong person.
Classic Outlook automation can send without displaying the draft by using .Send in place of .Display. That change removes the review step; it does not bypass account setup, organizational policies, or mail delivery checks. Test with a harmless recipient and a non-sensitive attachment before considering unattended sending. A macro that sends automatically should also validate addresses, confirm that the attachment exists, and handle errors without silently treating a failed send as successful.
Do not assume that using .Send means the message has reached the recipient. It asks Outlook to submit the message, while delivery can still be delayed or rejected. For business workflows, keep an appropriate record of what was prepared and sent, and follow your organization’s rules for automated email.
Alternatives when only New Outlook is available
If New Outlook is the only Outlook app available, the classic COM macro above is not the right solution. The alternatives differ in setup, permissions, and how much development they require:
- Microsoft Graph: A custom application can send mail through Microsoft 365 using the Graph API. It requires an authentication design and appropriate permissions, such as permission to send mail. An administrator may need to approve the application. A VBA macro can make web requests, but safely handling modern sign-in, tokens, and organizational consent is considerably more involved than creating an Outlook COM object. Never put a reusable account password or long-lived access token directly in a workbook.
- Power Automate: A cloud flow can send mail using a supported Microsoft 365 connector, with Excel providing or triggering the information. The flow must be designed around a supported trigger and data source; it is not automatically invoked merely because a workbook macro runs. Some triggers or connectors may require a suitable license, and organizational policies can restrict their use.
- Manual handoff: VBA can save or prepare the attachment and provide the recipient and message text for a person to send through New Outlook. A
mailto:link can open a compose window in a configured mail app, but it is not a dependable way to attach a local file. The user can add the attachment manually.
There is no universal one-line VBA replacement that makes New Outlook behave like classic Outlook automation. For a small, user-reviewed task, preparing a file for manual attachment may be simplest. For a recurring organization-wide process, an approved Power Automate or Graph solution is generally a better fit than embedding credentials and service calls in individual workbooks.
Common problems and practical checks
If the macro reports that it cannot create an Outlook object, first establish whether classic Outlook is installed and configured. Having New Outlook open, or having it set as the default email app, does not supply the missing COM interface. If your organization has removed classic Outlook, ask IT which approved sending method is supported rather than trying to repair the VBA reference.
If the message opens but the attachment is absent, check the exact path and confirm the file exists. In the example, the workbook must be saved because ThisWorkbook.FullName needs a real file location. If the workbook has unsaved changes, the attached saved copy may not include the latest edits; save it before running the macro.
If the message appears from an unexpected account, check the accounts and policies configured in classic Outlook. The sample does not explicitly select a sending account. Similarly, a successfully displayed draft is not proof that it was sent: the user still has to press Send. For automated sending, test the account and approval requirements with your administrator.
Macros may also be blocked by Excel’s security settings or by an organization’s policy. Use only workbooks and code you trust, and do not lower security protections just to run an unknown macro. For a managed Microsoft 365 environment, IT may have specific rules for macros, application permissions, and automated email.
Windows, Mac, and web limitations
This COM-based example targets Excel for Microsoft 365 on Windows together with classic Outlook for Windows. Excel for the web does not run VBA macros. Excel for Mac can run some VBA, but it does not use Windows COM automation, so this Outlook-specific code is not a cross-platform solution. A Mac user needs a separate supported mail workflow rather than assuming that the Windows macro will work unchanged.
Within Windows, late binding avoids a compile-time Outlook library reference, but it does not remove the requirement for a compatible Outlook automation interface at runtime. Installing or opening New Outlook alone is not enough. Check with your IT team before changing Outlook installations, particularly on a managed device where the available versions and account configuration are controlled centrally.
Frequently Asked Questions
Can Excel VBA send email through New Outlook?
Not through the traditional Outlook COM automation method. New Outlook for Windows does not expose the Outlook Object Model that macros using Outlook.Application rely on. Use classic Outlook for that method, or choose an alternative such as an approved Graph or Power Automate workflow.
Can VBA attach a file to a New Outlook email?
VBA cannot use the classic Outlook attachment method to control New Outlook. A macro can prepare the file, but a person may need to attach it in a compose window, or an alternative email service integration must handle sending and attachments.
Will the macro work if New Outlook is my default mail app?
No, not on that fact alone. The example asks Windows for the classic Outlook COM automation object; it does not use the default mail app setting to select a compatible automation interface.
Can I use VBA to send the message without showing it?
With classic Outlook, the macro can use .Send instead of .Display. That removes the review window and should be used only after testing recipients, attachments, account selection, and error handling. It does not make the code compatible with New Outlook.
Can a mailto link include an attachment?
A mailto link can request a compose window with details such as a recipient or subject, depending on the mail app. It is not a reliable standard mechanism for attaching a local file. For a dependable attachment workflow, use an approved mail API or add the file manually.
Related
- Flash Fill in Excel: Keyboard Shortcut and How to Use It
- Autofill in Excel From Another Cell: A Practical Guide
- Excel Data Validation Source: How to Find It
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Excel VBA: Save a Sheet as a Web Page with FormattingYes. In desktop Excel for Microsoft 365 on Windows, VBA can publish one worksheet as a static HTML…
- Excel UserForm Combo Box: Add, Populate, and Use ItAn Excel UserForm combo box is a VBA control that lets someone choose an item from a drop-down…
- VBA Loop Through Excel Tables by Name in a WorkbookIn Excel VBA, access a table by its name through the worksheet’s ListObjects collection: use ThisWorkbook.Worksheets("Data").ListObjects("SalesTable"). To loop…
- How to Put a Photo in a VBA UserFormTo put a photo in an Excel VBA UserForm, add an Image control, then either set its Picture…
- VBA Range Column: How to Reference ColumnsIn VBA, reference a whole worksheet column with Columns("C") or Range("C:C"); to get the column containing a particular…
- Excel Macro Error? Common Causes and FixesAn Excel macro error usually means VBA is blocked, the code cannot find an expected workbook, worksheet, or…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.