General discussion


Spell Check

By tptbusines_98 ·
I am creating an application in MS-Access 97.
I have added an automated process of sending an email through Microsoft
How do I add "spell check" properties to the following code:

Private Sub Form_Load()

Dim objOutlookApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMail As Outlook.MailItem

'Set the application objects
Set objOutlookApp = Outlook.Application
Set objNameSpace = objOutlookApp.GetNamespace("MAPI")

'Login to Outlook

'Set the mail item
Set objMail = objOutlookApp.CreateItem(olMailItem)

'Set properties for the mail item and send mail
With objMail
.BCC = ""
.Subject = "Message Sent from Visual Basic"
.Body = "This message was created by automating Outlook from
End With

'Logoff NameSpace

'Release objects
Set objMail = Nothing
Set objNameSpace = Nothing
Set objOutlookApp = Nothing

End Sub

Charles L. Phillips

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by p7ants In reply to Spell Check

Add this code just before the .send in the with objmail...

'Need to reference Microsoft Word 9.0 object model

Dim oWord As Object
Dim oTmpDoc As Object
Dim lOrigTop As Long

' Create a Word document object...
Set oWord = CreateObject("Word.Application")
Set oTmpDoc = oWord.Documents.Add

' Position Word off screen to avoid having document visible...
lOrigTop = oWord.Top
oWord.WindowState = 0
oWord.Top = -3000

' Assign the text to the document and check spelling...
With oTmpDoc
.Content.Text = objMail.Body

' After user has made changes, get text back...
objMail.Body = .Content.Text

' Close the document and exit Word...
.Saved = True
End With
Set oTmpDoc = Nothing

oWord.Top = lOrigTop
Set oWord = Nothing

Related Discussions

Related Forums