Outlook 2016 macro to edit received email - vba

I would like to be able to add notes to received emails so that I can keep track of work I've done or need to do. We just switched from Lotus Notes to Office365 and after doing some research I've figured out how to edit a received email. You have to open the email then go to Actions --> Edit Message.
Those aren't too many steps but a keyboard shortcut or button would make it much faster.
I did some research and learned a bit about Macros. I don't know how to write VB and was wondering if anyone could give me a hand writing it.
These are the steps I would need:
Open the currently selected email
Make it editable
As a bonus I would like change the font color to red. It just delineates text I've added versus the original email.
Thanks, any help would be appreciated.

Thanks #victor, your comment led me to the right place.
This is what I used in case anyone else would like to know:
Sub OpenForEditing()
ActiveExplorer.Selection(1).Display
ActiveInspector.CommandBars.ExecuteMso "EditMessage"
End Sub

Related

Recalculating Cells

I have a list with email addresses that were pulled into a an excel sheet. I want the emails to show as mailto links. If you double click into the cell and then hit enter that is what happens. But the list is long and I want to do it for every row. Is there a macro I can use to complete this task for me? Recording didn't really help.
Sounds to me like you want to use the
=HYPERLINK("mailto:")
function, not sure if you actually want to be able to generate emails and send them or just prefer that format for the cells. This site will help you.
Hope this helps and Good luck!!

Macro code (for PowerPoint) that prompts the user to enter text, then does a find/replace?

My Vb skills are beyond rusty so thank you very much in advance for the help. Can someone please share the code for a macro that will:
1) Prompt a user who opens an existing PPT to enter a value, let's say name. E.g. - "Please enter a name". Then the user clicks ok or enter.
2) Searches through every slide in the deck and where ever (literally) <Insert Name here> is found, it replaces that with the name the user entered.
Hopefully that makes sense. If someone can share that code with me, I would be extremely grateful! Many thanks again!
P.S. - in case it matters, I'm using MS office 2011 (version 14.1.3)
Mightn't it be simpler to use Edit | Find | Replace and let PowerPoint do the heavy lifting for you?

VBA to generate a default file name when Save As is selected in Word 2016

I have VBA that, in Word 2010, will default a file name into the Save As screen when the user selects the Save As file option. Word 2016 (Office 365) has a different interface with a screen to select a save location (OneDrive, This PC,etc) prior to the "standard" Save As dialog box appearing which seems to have broken the code to generate a specified default file name.
The code (with title simplified) is
Sub FileSaveAs()
With Dialogs(wdDialogFileSaveAs)
.Name = "MyTitle"
.Show
End With
End Sub
If I run the code in Developer to Debug, it works fine, with the Save As screen appearing and the file name defaulting but it does not work in the live environment where the file name defaults to the previous document name.
Based on web research, I have tried additional code to change the properties of the document place the name in the title as this is supposed to then default when Save As is selected but that also doesn't work.
Any suggestions or recommendations on how to resolve this would be appreciated.
Thanks!
Update 1/11/16:
Have been able to get a little closer by using the following:
Application.DocumentBeforeSave Event
example here https://msdn.microsoft.com/en-us/library/office/ff838299.aspx
tied to Using Events with Application Object
example here https://msdn.microsoft.com/en-us/library/office/ff821218.aspx
Had to add
Cancel=True
to the end of the event procedure code or the Save as Dialog box will open twice.
Still a bit clunky and seems to be limited to run only before the first user generated save event but almost workable.
Wanted to share what I found in case it helps others but any other suggestions for improvement would be appreciated as it still doesn't seem like the best solution.
Thanks again!
Thanks for reporting this. I have a potential workaround that I hope will help.
Could you use the SendKeys method (https://msdn.microsoft.com/en-us/library/office/gg278655.aspx) to send the keyboard shortcut (F12 for the Save As dialog, full list: http://aka.ms/Tf6yv0) to the application e.g.
App.SendKeys("{F12}")
when you need the Save As dialog to be displayed?
I hope this helps. Thanks again for bringing this issue to our attention, we will be looking further into the root cause.

Using VSTO to perform an action via selected e-mail text in Outlook

This should be pretty a pretty common scenario, but I have not found a solution yet.
I would like to highlight some text within the body of an e-mail and then click on something (context menu, toolbar button, etc) to perform a URL navigation using the selected text. For example, highlight the Fex Ex tracking number and then navigate to their web site using it as a query parameter (like "ww.fedextracking.com?packageid=12345").
How can you capture the selected text within an e-mail and then perform an action? I would greatly appreciate any suggestions or examples.
Thank you!
For Outlook 2007-2010 (or previous versions using WordMail), you can retrieve a Word object from the Inspector.WordEditor property. Then you can work with Word.Selection to access the selected text.
However, for Plain Text or Rich Text scenarios with Outlook 2000-2003, you have to use the SafeInspector object with Redemption (http://www.dimastr.com/redemption/) to access the selected text. I can't remember, but for HTML format messages with Outlook 2003-2003 you may be able to access the selected text with the IHTMLDocument object retrieved from SafeInspector.
I appreciate it's 588 days since you asked your question Loki70, but if somebody else Googles up this page (like I did, looking for how to create a selected text right-click context menu entry) then this may be an answer for you.
I have been using AutoHotKey, which works not just in Outlook, but everywhere in Windows, and have been writing utilities to Google the selected text, open an SSH session in PuTTY to the selected hostname, and similar.
If you don't mind running an extra application on your PC to capture the hotkey combination that you send, then this would do exactly what you're asking.
Here is my post on the AutoHotKey forum with a link to my code:
http://www.autohotkey.com/community/viewtopic.php?t=86402
It would be trivial to adapt this to do the FedEx query you've mentioned.
I hope this helps.

Capture right-click'd text on Outlook Message Content

I'd like to know if it's possible to capture the text when a user right-click's on an Outlook message, and then add items to the right-click menu depending on the type of text.
This is an example of what I'd like to do. If there's a message (mail item) with the following content: "Hello, please call me at 555-8474 regarding item A1234" and the user right-click's on the number "8", the pop-up context menu will have an extra item at the bottom called "Call 555-8474", and a "PhoneCall" sub will be run if selected. If the user right-click's anywhere on "A1234" a different item (i.e. "Look up A1234") will be shown.
We're running Outlook 2003 and if possible I'd like to know if this can be done using VBA. I'm open to other ideas as well. Thanks!
You can use this example in VBA to get started
SmartTags is an Office 2003 feature that was designed for exactly this sort of thing. I honestly don't know SmartTags well enough to do more than wave in the general direction, so I hope you get a better answer from a domain expert....