Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove option in Outlook with VBA code

Status
Not open for further replies.

Dina01

Programmer
Mar 26, 2002
204
CA
I create a little template in word, and when the template is open, you have to fill up the pop up forms, on one of the forms you have the choice to send the document to a particuliar person in outlook.

Since I got upgrade to office 2002, my document is not able to open outlook without bugging, it keeps on telling
" Impossible to start Microsoft WordMail. Close all dialogue open in Word and try again. "


Here is my code for the send function on the form that open word....
**************************

Public Function SendMessage(DisplayMsg As Boolean, Optional AttachmentPath)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.mailitem
Dim objOutlookRecip As Outlook.recipient
Dim objOutlookAttach As Outlook.attachment
'Create the outlook session.
Set objOutlook = CreateObject("Outlook.Application")
'Create the message
Set objOutlookMsg = objOutlook.createItem(olMailItem)
With objOutlookMsg
'Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("mtlserrurerie")
objOutlookRecip.Type = olTO
.Subject = "Demande de clé"
.body = ""
.importance = olimportancehigh 'High Importance
'Add attachment to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
'Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
'Should we displaythe message before sending?
If DisplayMsg Then
.Display
Else
.Save
.send
End If
End With
Set objOutlook = Nothing
End Function

***************************************

This is a multi user application and I don't want the user to go to Outlook and then remove the check mark from the option. "Use word to modify eletric messages".....I only want this option to be unchecked when I send this form.....
It works fine if the option in unchecked.

I think I need something like this in my code

Application.SetOption "NOT TOO SURE THE NAME ", False


Can anyone please help me
 
Can anyone please help me with this problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top