PDA

View Full Version : Solved: The case of Word editor in Outlook



samuelwright
12-05-2005, 04:30 AM
Hi all

I have read a few of the threads regarding setting/unsetting the Word Editor as the Outlook message editor (e.g. http://vbaexpress.com/forum/showthread.php?t=5042). I am having a similar sort of problem, that is slightly different, but related...

I have a macro form that is loaded from a toolbar button on a new message. This form helps to write the subject line in the correct format I want. However, whenever Word is selected as the default editor, it doesnt show the button, PLUS it puts in all the macros I have running on Word, which I dont want to happen with Outlook. It is frustrating.

I would like to know if this can be disabled, ie when a new message is opened, I want my toolbar button (with associated macro) to be available, regardless of whether Word is selected as my default editor or not. Also I dont want my Word macros to appear. Is it possible for a procedure to be written that interrogates the application that is running, something along the lines of:

If <Active window is an Outlook New Mail message> then Call <Outlook Sub>
elseif <Active window is Word document> then call <Word sub>

(I dont know the specific syntax, sorry:dunno ).

Sam

Marcster
12-05-2005, 05:29 AM
Hi Samuel :hi: ,
Not sure if this idea can help you out or not :dunno :

The following Registry key determines which editor is the default one:
(9.0 = Outlook 2000, 10.0 = Outlook 2002, 11.0 = Outlook 2003)

HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail\Editor Preference

The value it holds is either:
65537 DWORD - Word is the editor
or
65536 DWORD - Outlook is the editor

So you could write something along the lines of:

If <EditorPreference = 65536> then Call <Outlook Sub>
elseif <EditorPreference = 65537> then call <Word sub>

Please let me know your thoughts on the above...

Marcster.

samuelwright
12-08-2005, 08:31 AM
Hi Marcster

I checked out a neat KB Entry by MOS MASTER (how to dynamically put a button on the Outlook Toolbar). This enters the button on the toolbar as normal, and it does it in Word as well...however, MOS MASTERS code ensures that the button is only functional for email messages...therefore it does not work in Word! I simply wrote a small piece of code which deleted the button when Word opened!

Sam

Marcster
12-08-2005, 08:58 AM
Cool. Glad you sorted it out. :)

Marcster.

samuelwright
12-08-2005, 10:04 AM
Ahaha, but here is something else I wasnt anticipating that has just revealed itself! oh no!!

The facts are:

1. Word 2003 is selected as the default message editor.
2. When Outlook starts, some VBA posts a new button onto the New Message toolbar (and Word-but I got rid of that one, see above...)
3. This new button is programmed to load and show a userform which outputs a string into the Subject Line of the message.

Here is the problem:

1. When I click the button, the form loads, but it does not show in front of the New Message, but behind it (ie in terms of window layers it goes Outlook Inbox-UserForm-New Message!)

I dont want to have to minimise the New Message window to show the UserForm. Is there any way of bringing the Userform to the front? I have tried putting a userform.visible in the Initialize event, but to no avail.

PS this is not a problem when Word is not the default message editor...