PDA

View Full Version : Open Trust Center Settings with VBA



ronbrandsted
11-26-2014, 03:50 AM
Hi,

Is there a way to open the Trust Center Settings (the "Programmatic Access" page) of Outlook (i'm using 2010) with VBA code?
I know it's not possible to change these settings with VBA, but I want to create some kind of shortcut to those settings.
Every day I have to change these settings and I want to skip the daily journey through the menu.


Thanks.

Jeroen

westconn1
11-27-2014, 04:27 AM
this is for an older version, so you will have to make some changes, but the basic concept will work

Set cb = ActiveExplorer.CommandBars("Menu Bar").Controls("&Tools").Controls("&Macro").Controls("&Security...")
cb.Execute

it may be possible to change settings using sendmessage, there are examples available for doing this in excel, but would require to be done from a separate instance of an IDE, maybe excel or word, or of course, a compiled exe

ronbrandsted
12-01-2014, 07:33 AM
Thanks Westconn1. With some changes I managed to open the security center with your code!

Changing these settings is a bit too complicated for me. But being able to open the trust center helped me a lot.

Jeroen

skatonni
12-02-2014, 03:37 PM
Put the "Macro Security" button on the Quick Access Toolbar or a ribbon. It is a yellow triangle with an exclamation point.

If anyone can think of a reason for using VBA it looks like this.


Sub ExecuteMso_MacroSecurity()
ActiveExplorer.CommandBars.ExecuteMso ("MacroSecurity")
End Sub

ronbrandsted
12-03-2014, 09:54 AM
Thx Skatonni for your reply. Your code works very well. I used it in an MS Access form, to help users to change the outlook setting "Programmatic Access" (the Access database needs to access some mails in Outlook).
The ExecuteMso command is very useful. Now they don't have to click their way through the Outlook Options.

But your code opens the MarcoSecurity settings. But I want it to open in Programmatic Access. So I downloaded the idMSO table from Microsoft to look for the id of Programmatic Access. But I couldn't find it. In the table I see the idMSO of other pages of the Trust Center, like Privacy Options, but not Programmatic Access.

Do you know how to open Trust Center on the Programmatic Access page?

Thanks!
Jeroen