Bring the security message box to the front when using Outlook VBA to send an email - vba

I'm writing code to automate sending an email from Excel. Whenever the send function of Outlook is executed, there is a warning/security message box to approve before the email is sent.
The message box is beneath the other forms so the user has to find this message box to proceed with the other tasks.
Is there a way to have this message box appear on top?

The warning message is there for a reason.
However, you can bypass it, but you have to code the functions in C++ and call them from VBA or use a commercial lib that has already done this.
One i've used is: Redemption, website

I've been able to solve the "messagebox on top" issue by using the following:
Set outlookProgram = CreateObject("Outlook.Application")
outlookProgram.ActiveExplorer.Activate
Thanks for all you help guys.
P

Related

how to display some message once user starts to compose new email

For Office 365 Outlook Web App, we would like to convert attachments to links once end user uploads them, however we didn't see an attachment notification event at current Outlook Addin.
Another approach we could do is to ask them to use our own buttons for uploading, however we need to guide end user to use our own buttons, could we add some message at top of email body like below once new email message box is displayed?
Somehow based on our research, Outlook Addin only has one event right now which is SendEvent, could someone confirm this? if so, it is rather limited.
To display a custom message use Office.context.mailbox.item.notificationMessages object. For example to add a message to current item the code may looks like ...
Office.context.mailbox.item.notificationMessages.addAsync("information", {
type: "informationalMessage",
message : "My custom message.",
icon : "iconid",
persistent: false
});
Be aware there are a maximum of 5 notifications per message and maximum length of each message text is 150 characters per Office.NotificationMessageDetails interface.
For the secondary question you would need to look at available events in Office.EventType enum. Over here you'll see few events available to Outlook app. One of them you are interested in is AttachmentsChanged which is currently available only in Preview (not released yet, but will be soon).

Send keys in VBA on appearance of dialog box

Back in this question, I was looking for a way of disabling a particularly troublesome dialog from Outlook that warned me the attachments I was sending might be unsafe. Having concluded that the only security-setting options were unavailable because of administrator privileges, I've instead been trying to look for a workaround to have a script active within Outlook that does something like the following (pseudo VBA):
sub PollForDialog()
if dialogbox = open and dialogbox.name = "This outgoing message may..." then
Sendkeys arrowleft + enter
I've tried exhaustively to search for how to have scripts execute upon a messagebox popping up, and I haven't had any luck. Plenty of stuff about dialog boxes opening when a script is run, but nothing I can find on how to trigger on a dialog opening. Anyone able to help?
Thanks muchly.

Create Msg Read View Outlook

I'm writing an Outlook Addin Ribbon in VB.net and getting on with it rather well, however I've come to a point where I'm stuck.
When sending an item, I also need to save the file in the reading format which it would appear in the 'Sent Items'.
If have tried mailItem.SaveAs("path", olSaveAsType) but it only saves as a draft item. Whereby you can edit the text.
I tried to loop through the sent items in the 'sent items' folder after sending, however Outlook hangs whilst my code is executing, thus holding up the actual sending of the email.
Is there a way this can be done?
Any help, hints or tips would be appreciated!
Message submission is an asynchronous process. Set up the Items.ItemAdd event handler on the Sent Items folder (Namespace.GetDefaultFolder(olFolderSentMail)) and process the sent message in the ItemAdd event handler.

Message Box pop up not cleared properly

I have an application in VB.net. I am using the msgbox inside the execution of a loop. Now the message box pops up fine, but when i click on "Ok" in the pop up, the message box
any help will be much appreciated.
I'm guessing that the end of the question is the same as the subject, namely, that in a loop, the message box pops up but when OK is clicked the message box is not "cleared properly".
It sounds like the loop is running tightly enough that the system cannot process any messages and refresh the window.
Without seeing any code, however, this is just speculation and an appropriate solution cannot be given. You might try adding a .Refresh() call after the message box to the form/window or whatever to get the screen to update.
Please provide more information if possible.

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.