Outlook VBA: how to retrieve the folder(s) from the taskbar Move menu list? - vba

I am trying to retrieve via VBA the last entry (or all entries) of the directories list shown in the Move menu of Outlook. This menu is normally visible in the Home taskbar. The objective is thereafter to re-use this directory for instance to "change focus window to the last used folder" (from this list).
I have checked in the Microsoft documentation but could not find it, though I might have missed it.
I also didn't find it in the OlDefaultFolders list, which is logical since it's not a folder in the tree view anyway, but only a list of recently used folders.
I did look into this thread but the objective of the question author seems a bit different as there is no question of the Move menu: Get the folder where the last mailitem was moved in Outlook?
Did anyone had the same issue or find a way to circumvent this problem?
Maybe to store the last used folder elsewhere each and every time an email is moved... a bit overkill but that could work I guess.
Thanks in advance for your help!

Related

Is there a way to package add-ins so that users only have to click one to use all macros within it?

I've got a dozen macros that have 90% similar code. I've created 4 sets of VBA in an add-in file so that I don't have to revise a dozen different places any time a change needs to be made. The plan is to end up with:
specific code
universal code A
specific code
universal code B
The users are not particularly tech-savvy so I want to make the distribution as painless and idiot-proof as possible.
Also, the add-ins don't have to be visible--no one is going to run them on their own, they're just going to be embedded and called upon from other macros.
I've looked around online and the closest thing I've found is this How to combine multiple VBA macros into one add-in file for Excel
It still looks like this is geared more towards having multiple buttons, which I really don't need (or want...I don't actually want ANY buttons)
Not really sure what kind of code I could show to help with this problem, since I don't know if this is even possible to do.
Once you save the XLAM file you just have to click on Excel Add-ins under the Developer tab, browse to the folder where it is stored, and open. It will then appear as an add-in package that you can click on.

Outlook VBA Restrict on All Items

I was hoping to find a way to get an Outlook items collection for all items, regardless of what folder they may be sitting in so I can do a restrict on every item, no matter where someone may have moved it. Does anyone know if this is possible? I was poking around in the Outlook object model but I couldn't find anything.
You can use Application.AdavncedSearch to search the top level folder of the store including subfolders. Keep in mind that the search is asynchronous, so you will need to wait for the Application.AdvancedSearcvhComplete event to fire.

Get document's name with it's description

Trying to get the name of the active window with it's description, can't find any method.
My problem is that while I can access document's file name with Document.Name, I can't get the commentaries that Word attaches to it, like (Compatibility Mode, Last modified by User etc), without them, the method Windows(Document.Name) doesn't work, is there any solution for this?
My program opens four new documents and switches in a loop the active document, taking information from the original and putting some excerpts in the new ones.
Everything works when there is no commentaries for documents, but as they appear, program breaks, saying:
5941 The requested member of the collection does not exist
Thanks for reading!
This:
Windows(1).Document
will give you the document associated with a window. (You may need to loop through the windows to find the one you're interested in.)
Once you have the document you can access its properties:
Windows(1).Document.CompatibilityMode
Hope that helps

ActiveX controls changing to pictures (Excel/VBA)

My company creates workbooks for clients that contain ActiveX controls (in most cases we need the extra functionality as compared to Form Controls). When we create them, they work fine on our end, but when we zip them up and send them to our clients, they open the WB and the ActiveX controls are no longer ActiveX controls, if you right click it, it behaves like a picture.
I feel like this is due to the MS ActiveX debacle. I have had them run the Fix It and making sure all the MS Office components were closed, and had them reboot, but still nothing.
I am pulling out my hair, and have asked on other forums if anyone else has had this issue, and what they have done to fix it. Thanks in advance.
Could you please check in client system whether macros and active x controls are enabled in Trust center setting?
https://support.office.microsoft.com/en-us/article/Enable-or-disable-macros-in-Office-documents-7b4fdd2e-174f-47e2-9611-9efe4f860b12?CorrelationId=fe6a4d24-f4d9-4c6b-afa0-40d2828ad22e&ui=en-US&rs=en-US&ad=US
use above link if needed.
Try closing excel and deleting the .EXD files from your computer.
Source: http://www.mrexcel.com/forum/excel-questions/296750-command-button-turned-into-image.html
While saving the Excel document, save it as "Macro enabled workbook".xlsm
In my case, the worksheet prompts a non responsive error sometimes. When I reopen it, Excel repairs it and turns all active X check boxes (sometimes drop down list and command buttons) into images. It happened many times and I had to spend a lot of my time recreating them and liking to cells.
I experienced a similar problem when Excel repaired a file; this may be similar to what's happening with the Zipped file. FormControl Buttons don't appear to have the same problems but I see you want to keep the additional functionality of the ActiveX Control.
You may be able to make use of the code I created by inserting one Form Control button that runs the Sub RepairMissingButtons() that your clients can press to restore the images to CommandButtons. This currently fixes buttons for any selected sheets, so you'd want to first identify which sheets need to be selected (or add a form control button on each sheet that needs the repair done).
You'd need to modify the Sub CreateButton() to meet your needs (currently requires hard-coding the Caption, BackColor and any other ActiveX properties that may have been lost by the button being converted to an image):
Reverse Excel ActiveX command buttons erroneously converted to images after corrupted file repair
Having this problem, activex controls sometimes change to pictures.
Many places around the internet the answer is: Use form controls, well as far as I can tell form controls don't actually do anything useful.
Even Microsoft's support site says, recommend using form controls, how can that be the answer. being able to interact with VBA is as far as I can tell the only reason to use Microsoft applications instead of free ones.

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.