Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Outlook Spellcheck (Outlook 2003)

    I've written an outlook macro which works beautifully. "Send & File" (code below) interrupts the Send process and asks the user to pick a folder for the sent message to be stored in. There's just one glitch.... although we have "always spellcheck before sending" turned on, spellcheck does not kick in when this code is used. I don't find any spellcheck method or spellchecked property for a mail item. Am I overlooking something, or is this how Outlook intends things to be?

    Thanks, Richard Barrett

    Sub SendAndFile()
    Dim objNS As NameSpace
    Dim objInBox As Outlook.MAPIFolder
    Dim objFolder As MAPIFolder
    Set objNS = Application.GetNamespace("MAPI")
    Set objInBox = objNS.GetDefaultFolder(olFolderInbox)

    Set objFolder = objNS.PickFolder
    ' Verifiy that a folder has been chosen and that it is a mail folder (0)
    If TypeName(objFolder) <> "Nothing" And _
    objFolder.DefaultItemType = 0 Then
    If objFolder.StoreID <> objInBox.StoreID Then
    MsgBox "You must Save to a Personal folder."
    GoTo DisableToFalse
    End If

    Dim Item As Outlook.MailItem
    Set Item = Application.ActiveInspector.CurrentItem
    Set Item.SaveSentMessageFolder = objFolder 'no "Item" in this case
    Item.Send
    Set Item = Nothing
    Else
    MsgBox "You must chose a folder that contains Mail Items."
    End If
    Set objFolder = Nothing
    Set objNS = Nothing
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Outlook Spellcheck (Outlook 2003)

    The VBA object model in Outlook is limited to basic manipulation of items. Many of the features that are available in the interface are not exposed in VBA; spell checking is one of them.

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: Outlook Spellcheck (Outlook 2003)

    I actually succeeded with this by 'finding' the Spell Check control under the Tools menu and using the .Execute method. It works very well. (Code below.)

    I had a bit of trouble with this until I realized that the inspector must have focus in Windows, not simply be the active inspector in Outlook. In other words, this can't be run successfully from the VBE.

    Sub SpellCheck()
    On Error Resume Next
    Dim ctrl
    Set ctrl = ActiveInspector.CommandBars("Tools").FindControl(I D:=2)
    ctrl.Execute
    End Sub

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Outlook Spellcheck (Outlook 2003)

    Good tip. This can be boiled down to:

    ActiveInspector.CommandBars.FindControl(ID:=2).Exe cute
    -John ... I float in liquid gardens
    UTC -7DS

  5. #5
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: Outlook Spellcheck (Outlook 2003)

    Oh... I didn't realize that the specific command bar item was not required. I suppose the ID is unqique, so it doesn't matter where it is.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •