Created
January 15, 2023 08:51
-
-
Save stevedep/b0e876b49b78e99b27167707e965324f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub openmail() | |
Set oOutlook = GetObject(, "Outlook.Application") | |
Set NS = oOutlook.GetNamespace("MAPI") | |
NS.Logon | |
Set msg = NS.GetItemFromID(ActiveCell.Value) | |
msg.display | |
Set objInsp = msg.GetInspector | |
Set objDoc = objInsp.WordEditor | |
Application.Wait (Now + TimeValue("0:00:02")) | |
Set myRange = objDoc.Range(Start:=ActiveCell.Offset(0, 5), End:=ActiveCell.Offset(0, 6)) | |
myRange.Select | |
Set oOutlook = Nothing | |
Set NS = Nothing | |
Set msg = Nothing | |
Set objInsp = Nothing | |
Set objDoc = Nothing | |
Set objsel = Nothing | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment