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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to use groupwise 7 and not Outlook

Status
Not open for further replies.

assets

Technical User
Oct 23, 2002
574
AU
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
----------------------------------------------------------------
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 :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top