From: Graham Mayor on 13 Feb 2010 09:04 In developing an application for Word which sends e-mail messages using Outlook, I came across an issue that I have not been able to resolve. Hopefully someone will have a plan :) With Outlook's options configured to spell check the message before sending, each message processed creates the message 'Word finished checking the selection. Do you want to continue the remainder of the document' which requires user intervention. Clearly if the option is switched off in Outlook, the message doesn't occur. As I have no control over whether users have this option set or not, I would like to switch off the spell checkling for the duration of the process and thus avoid the need for user interaction. Solutions posted on the web all seem to revolve around setting the registry entry associated with the option - along the lines of Dim myWS As Object Dim RegKey As String Dim Key As String Dim Ver As Variant Ver = Application.version Key = "HKEY_CURRENT_USER\Software\Microsoft\Office\" _ & Ver & "\Outlook\Options\Spelling\Check" Set myWS = CreateObject("WScript.Shell") 'Read key from registry RegKey = myWS.RegRead(Key) 'Write new value myWS.Regwrite Key, 0 'send message 'Write back original value myWS.Regwrite Key, RegKey While this certainly changes the registry, it has no effect on the problem unless Outlook is closed and restarted. Does anyone know of a way to suppress this message from vba that does not involve restarting Outlook? -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
From: Ken Slovak - [MVP - Outlook] on 13 Feb 2010 12:49 Unfortunately that's just one of a bunch of settings that are read on startup and then maintained in memory. So the registry settings are only read on startup. About the only thing I can think of would be a real hack involving Win32 API stuff to send a WM_CLOSE message to that dialog when it opens, monitoring for it opening. Depending on version and whether or not WordMail was used there'd probably be different classes for the dialog, that would take some work with Spy++. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Graham Mayor" <gmayor(a)REMOVETHISmvps.org> wrote in message news:OIyg8VLrKHA.3792(a)TK2MSFTNGP05.phx.gbl... > In developing an application for Word which sends e-mail messages using > Outlook, I came across an issue that I have not been able to resolve. > Hopefully someone will have a plan :) > > With Outlook's options configured to spell check the message before > sending, each message processed creates the message 'Word finished > checking the selection. Do you want to continue the remainder of the > document' which requires user intervention. Clearly if the option is > switched off in Outlook, the message doesn't occur. As I have no control > over whether users have this option set or not, I would like to switch off > the spell checkling for the duration of the process and thus avoid the > need for user interaction. > > Solutions posted on the web all seem to revolve around setting the > registry entry associated with the option - along the lines of > > Dim myWS As Object > > Dim RegKey As String > > Dim Key As String > > Dim Ver As Variant > > Ver = Application.version > > Key = "HKEY_CURRENT_USER\Software\Microsoft\Office\" _ > > & Ver & "\Outlook\Options\Spelling\Check" > > Set myWS = CreateObject("WScript.Shell") > > 'Read key from registry > > RegKey = myWS.RegRead(Key) > > 'Write new value > > myWS.Regwrite Key, 0 > > 'send message > > 'Write back original value > > myWS.Regwrite Key, RegKey > > > > While this certainly changes the registry, it has no effect on the problem > unless Outlook is closed and restarted. > > > > Does anyone know of a way to suppress this message from vba that does not > involve restarting Outlook? > > > -- > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > Graham Mayor - Word MVP > > My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > >
From: Graham Mayor on 14 Feb 2010 01:14 Thanks Ken - I had seen an earlier reference from you which essentially said the same thing. In this instance the problem arises because when the message is created from vba, part of it is selected at the time it is sent. It seems probable that all that needs to be done is to move the selection point to the start of the message before issuing the send command for the prompt to go away. As there won't be any spelling errors in the message (being part of a mail merge where that will already have been addressed) the spell check will not prompt for corrections and without the selection being selected, it won't attempt to spell check in two parts. :) -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Ken Slovak - [MVP - Outlook]" <kenslovak(a)mvps.org> wrote in message news:OuMp0UNrKHA.4492(a)TK2MSFTNGP05.phx.gbl... > Unfortunately that's just one of a bunch of settings that are read on > startup and then maintained in memory. So the registry settings are only > read on startup. > > About the only thing I can think of would be a real hack involving Win32 > API stuff to send a WM_CLOSE message to that dialog when it opens, > monitoring for it opening. Depending on version and whether or not > WordMail was used there'd probably be different classes for the dialog, > that would take some work with Spy++. > > -- > Ken Slovak > [MVP - Outlook] > http://www.slovaktech.com > Author: Professional Programming Outlook 2007. > Reminder Manager, Extended Reminders, Attachment Options. > http://www.slovaktech.com/products.htm > > > "Graham Mayor" <gmayor(a)REMOVETHISmvps.org> wrote in message > news:OIyg8VLrKHA.3792(a)TK2MSFTNGP05.phx.gbl... >> In developing an application for Word which sends e-mail messages using >> Outlook, I came across an issue that I have not been able to resolve. >> Hopefully someone will have a plan :) >> >> With Outlook's options configured to spell check the message before >> sending, each message processed creates the message 'Word finished >> checking the selection. Do you want to continue the remainder of the >> document' which requires user intervention. Clearly if the option is >> switched off in Outlook, the message doesn't occur. As I have no control >> over whether users have this option set or not, I would like to switch >> off the spell checkling for the duration of the process and thus avoid >> the need for user interaction. >> >> Solutions posted on the web all seem to revolve around setting the >> registry entry associated with the option - along the lines of >> >> Dim myWS As Object >> >> Dim RegKey As String >> >> Dim Key As String >> >> Dim Ver As Variant >> >> Ver = Application.version >> >> Key = "HKEY_CURRENT_USER\Software\Microsoft\Office\" _ >> >> & Ver & "\Outlook\Options\Spelling\Check" >> >> Set myWS = CreateObject("WScript.Shell") >> >> 'Read key from registry >> >> RegKey = myWS.RegRead(Key) >> >> 'Write new value >> >> myWS.Regwrite Key, 0 >> >> 'send message >> >> 'Write back original value >> >> myWS.Regwrite Key, RegKey >> >> >> >> While this certainly changes the registry, it has no effect on the >> problem unless Outlook is closed and restarted. >> >> >> >> Does anyone know of a way to suppress this message from vba that does not >> involve restarting Outlook? >> >> >> -- >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> Graham Mayor - Word MVP >> >> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> >> >> >
From: Ken Slovak - [MVP - Outlook] on 15 Feb 2010 08:51 One other possibility, which probably would only work for WordMail 2003 or earlier would be to try using Word code to disable spell checking in the document. You can get at Word from Inspector.WordEditor, which is actually Word.Document. Getting WordEditor is restricted in the object model, especially for outside code, but there is alternative code out there to get WordEditor using Win32 API calls and callbacks, bypassing the Outlook object model. I've posted it in the past in VB6, let me know if you need me to dig it out. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Graham Mayor" <gmayor(a)REMOVETHISmvps.org> wrote in message news:uMMZtzTrKHA.4752(a)TK2MSFTNGP04.phx.gbl... > Thanks Ken - I had seen an earlier reference from you which essentially > said the same thing. In this instance the problem arises because when the > message is created from vba, part of it is selected at the time it is > sent. It seems probable that all that needs to be done is to move the > selection point to the start of the message before issuing the send > command for the prompt to go away. As there won't be any spelling errors > in the message (being part of a mail merge where that will already have > been addressed) the spell check will not prompt for corrections and > without the selection being selected, it won't attempt to spell check in > two parts. :) > > -- > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > Graham Mayor - Word MVP > > My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
From: Graham Mayor on 15 Feb 2010 09:44
OK I'll look at that - at the moment (for Office 2007) I am simply reading the registry entry (where it exists), informing the user and disabling the function. Interestingly the issue does not arise when working with the same documents in Office 2003 with Word as e-mail editor (but then I suppose you have the issue there of not being able to select Word as e-mail editor from vba - as one door closes another opens). Whilst on the subject of Office 2003 the basic code segment (below) that works in Office 2007 does not work for me in Word 2003. I cannot decide whether this is because of a problem with the Office 2003 installation, or whether simply it doesn't work in Office 2003. It works with Word 2003 and Outlook 2007 and Word 2007 and Outlook 2007, but not Word 2003 and Outlook 2003 - and if it is my installation at fault, I can't put my finger on where :( Set oItem = oOutlookApp.CreateItem(olMailItem) Set objDoc = oItem.GetInspector.WordEditor Set objSel = objDoc.Windows(1).Selection With oItem .To = strEMail .Subject = "Subject" Selection.Copy .Display objSel.Paste End With 'Clean up Set oItem = Nothing Set oOutlookApp = Nothing -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Ken Slovak - [MVP - Outlook]" <kenslovak(a)mvps.org> wrote in message news:uDGZ$YkrKHA.4220(a)TK2MSFTNGP05.phx.gbl... > One other possibility, which probably would only work for WordMail 2003 or > earlier would be to try using Word code to disable spell checking in the > document. You can get at Word from Inspector.WordEditor, which is actually > Word.Document. > > Getting WordEditor is restricted in the object model, especially for > outside code, but there is alternative code out there to get WordEditor > using Win32 API calls and callbacks, bypassing the Outlook object model. > I've posted it in the past in VB6, let me know if you need me to dig it > out. > > -- > Ken Slovak > [MVP - Outlook] > http://www.slovaktech.com > Author: Professional Programming Outlook 2007. > Reminder Manager, Extended Reminders, Attachment Options. > http://www.slovaktech.com/products.htm > > > "Graham Mayor" <gmayor(a)REMOVETHISmvps.org> wrote in message > news:uMMZtzTrKHA.4752(a)TK2MSFTNGP04.phx.gbl... >> Thanks Ken - I had seen an earlier reference from you which essentially >> said the same thing. In this instance the problem arises because when the >> message is created from vba, part of it is selected at the time it is >> sent. It seems probable that all that needs to be done is to move the >> selection point to the start of the message before issuing the send >> command for the prompt to go away. As there won't be any spelling errors >> in the message (being part of a mail merge where that will already have >> been addressed) the spell check will not prompt for corrections and >> without the selection being selected, it won't attempt to spell check in >> two parts. :) >> >> -- >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> Graham Mayor - Word MVP >> >> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > |