![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi VBA to send Word document to Outlook 2007 and prior without opening
Outlook. Code I have still wants to open Outlook before it sends it from Outbox? Option Explicit 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 MsgBox "Document needs to be saved first" Exit Sub 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 = " .Subject = "New subject" 'Add the document as an attachment, you can use the .displayname property 'to set the description that's used in the message .Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _ DisplayName:="Document as attachment" .Send End With If bStarted Then oOutlookApp.Quit End If Set oItem = Nothing Set oOutlookApp = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Send Word doc attachment | Chris | Outlook and VBA | 3 | May 20th 08 04:41 PM |
I can send email with attachment receiver cannot open attachment | saffi | Outlook - General Queries | 8 | December 5th 07 10:06 AM |
why my Excel attachment to email opens with Word? | AJ | Outlook - General Queries | 3 | August 23rd 06 07:08 PM |
Auto BCC to a fixed address | Proboscis | Outlook and VBA | 2 | July 19th 06 08:36 AM |
Cannot change default Insert Attachment folder- FIXED | Cooler Dude | Outlook Express | 0 | March 5th 06 11:16 AM |