The code below works. It open outlook and pastes the information from word and send email.
Outlook causes problem with ohter programs. Groupwise is the stand email program so need code to replace reference to outlook
----------------------------------------------------------------
Never give up never give in.
There are no short cuts to anything worth doing![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Outlook causes problem with ohter programs. Groupwise is the stand email program so need code to replace reference to outlook
----------------------------------------------------------------
Code:
Private Sub Document_Close()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
'Get Outlook if it's running
'Set oOutlookApp = GetObject(, "Outlook.Application")
'If Err <> 0 Then
'Outlook wasn't running, start it from code
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
'End If
'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
'Set the recipient for the new email
.To = "me@mail.com"
'Set the recipient for a copy
'.CC = "recipient2@mail.com"
'Set the subject
.Subject = "New title"
'The content of the document is used as the body for the email
.Body = ActiveDocument.Content
.Send
End With
If bStarted Then
'If we started Outlook from code, then close it
oOutlookApp.Quit
End If
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
Never give up never give in.
There are no short cuts to anything worth doing