I was wondering if anybody could help me create an email button that will automatically send my entire workbook using microsoft outlook? Here the tricky part, at least for me, I'm doing this on a mac so i cant use ActiveX.
This is what i usually do:
Sub SendDocumentAsAttachment()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
ActiveDocument.Save
End If
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = "someone@somewhere.com"
.Subject = "New subject"
.Body = "See attached document"
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
.Send
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
But it wont run because of the CreateObject. If some one could help me I'd greatly apprecaite.
This is what i usually do:
Sub SendDocumentAsAttachment()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
ActiveDocument.Save
End If
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = "someone@somewhere.com"
.Subject = "New subject"
.Body = "See attached document"
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
.Send
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
But it wont run because of the CreateObject. If some one could help me I'd greatly apprecaite.