Opening & minimizing Outlook from Excel

trevolly

Board Regular
Joined
Aug 22, 2021
Messages
124
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Because our PC's at work are quite slow, I've written a v small piece of vba code so that when a colleague opens a specific form excel opens Outlook and displays a specific worksheet as the excel workbook opens. This means Outlook can load up whilst the excel form is being completed. This code works perfectly but I was wondering if anyone knows any vba code they could add that minimizes Outlook immediately as it opens ?

The vba code is placed in the "This Workbook" area of the workbook. I'm sorry I'm not using "XL2BB" but I'm not allowed to install it on my work laptop.

"Private Sub Workbook_Open()

Shell ("OUTLOOK")
Worksheets("Birdstrike").Activate
Range("F6:J6").Select
End Sub"


Appreciate all you help.
Trevor
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Amazing how many people have asked for this for the last 15 years and so many dead ends when researching and so many solutions that reportedly didn't work. After about an hour of piecing together ideas I came up with this (use your outlook.exe path). You need a reference to Microsoft Scripting Runtime IIRC.
VBA Code:
Dim ofSO As Object

Set ofSO = CreateObject("WScript.Shell")
ofSO.Run """C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE""", 7, False

Worksheets("D").Activate
Range("F6:J6").Select
You will may see the Outlook splash screen with some other number than 7 but I don't if I use 7.
If you click on outlook icon in task bar, you will maximize Outlook though. Running this from the vb editor I find that the sheet isn't activated so that may need tweaking. Perhaps it will for you if you run that from Excel wb and not the editor. I didn't try.
 
Upvote 0
Thank you for spending the time looking in to this @Micron. I didn’t realise it was a difficult process. I’m going to play with the code you’ve provided.
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,472
Members
452,516
Latest member
archcalx

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