VBA Outlook Screen Updating

jalrs

Active Member
Joined
Apr 6, 2022
Messages
300
Office Version
  1. 365
Platform
  1. Windows
Hello forum experts,

As the subject suggests I'm having trouble with outlook screen updating. I would like to turn it off, meaning that every time I run the macro, the outlook doesn't pop up a new window. Instead, it should just keep running on the taskbar. I've tried with Application.ScreenUpdating method, but this fails to work.

Any help is greatly appreciated.

VBA Code:
Sub mailIsencao()

Dim OutApp As Object
Dim OutMail As Object
Dim ws1 As Worksheet, ws2 As Worksheet

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set ws1 = ThisWorkbook.Worksheets("Readme")
Set ws2 = ThisWorkbook.Worksheets("MACRO 4")

ws2.Activate

On Error Resume Next

Application.ScreenUpdating = False

    With OutMail
        .To = Cells(2, 2).Value
        .CC = Cells(2, 3).Value
        .Subject = Cells(2, 4).Value
        .Body = Cells(2, 7).Value
        .Display
        .Attachments.Add "C:\Users\joafrodrigue\Desktop\share\finaldocname\ST_Isenção.xlsx"
        
    End With
    On Error GoTo 0

Set OutMail = Nothing

ws1.Activate

Application.ScreenUpdating = True

End Sub

Thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
What is this "new window" - outlook application itself or just a new email window? If the latter, don't use .Display - use .Send to send the email without seeing it.
 
Upvote 0
Solution
What is this "new window" - outlook application itself or just a new email window? If the latter, don't use .Display - use .Send to send the email without seeing it.
Hello Micron, thanks for the fast reply!

I'm aware of the .Send method as you suggested, however the .Display allows me to make up for any mistakes that might appear before sending the e-mail. It's just to reduce visual pollution.

Regarding your question, this "new window" is the outlook application opening, all I must do is manually click on send button.

Hope it was clear. If it's not possible, just let me know!

Thanks
 
Upvote 0
this "new window" is the outlook application opening, all I must do is manually click on send button.
My version of Outlook doesn't have a send button on the ribbon. Yours does somewhere? An email window does have a send button though. I think you are confusing the two windows. My email window opens full screen and I can't even see the Outlook app window at that time. Maybe if you post a screen shot of what you're seeing it would clear things up.
 
Upvote 0
My version of Outlook doesn't have a send button on the ribbon. Yours does somewhere? An email window does have a send button though. I think you are confusing the two windows. My email window opens full screen and I can't even see the Outlook app window at that time. Maybe if you post a screen shot of what you're seeing it would clear things up.
Sure, uplodaded as attachment.

Thanks!
 

Attachments

  • Untitled.png
    Untitled.png
    140 KB · Views: 27
Upvote 0
That's not the app window, it's an email window. What I'm not understanding is how you expect to not see that yet be able to modify the message?
 
Upvote 0
That's not the app window, it's an email window. What I'm not understanding is how you expect to not see that yet be able to modify the message?
As stated on my #3 post here, it would only be to reduce visual pollution while it loads. I would be able to modify the message by going to taskbar and just opening the desired e-mail window.

When I talk about reducing visual pollution, it's in the way that I don't have x amount of e-mail windows flashing through my screen (popping up), according to the x amount of e-mails I run on my macro.

I wonder if this is possible in any way

Thanks Micron!
 
Upvote 0
So you want it to open, but you want the email window to be minimized? Then perhaps add where appropriate

Dim objInspector As Outlook.Inspector
Set objInspector = EmailItem.GetInspector

use this instead of .Display
objInspector.Display
objInspector.WindowState = olMinimized

then continue by executing the lines that build the email. Don't forget to comment or remove the .Display line that you have.
 
Upvote 0
So you want it to open, but you want the email window to be minimized? Then perhaps add where appropriate

Dim objInspector As Outlook.Inspector
Set objInspector = EmailItem.GetInspector

use this instead of .Display
objInspector.Display
objInspector.WindowState = olMinimized

then continue by executing the lines that build the email. Don't forget to comment or remove the .Display line that you have.
I will try it and comeback if needed.

Thanks Micron!
 
Upvote 0
So you want it to open, but you want the email window to be minimized? Then perhaps add where appropriate

Dim objInspector As Outlook.Inspector
Set objInspector = EmailItem.GetInspector

use this instead of .Display
objInspector.Display
objInspector.WindowState = olMinimized

then continue by executing the lines that build the email. Don't forget to comment or remove the .Display line that you have.
I get the following error as attached.
 

Attachments

  • 1.png
    1.png
    159.5 KB · Views: 56
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top