PiaD
Wed May 07 08:32:13 PDT 2008
Thanks for the help. I am pretty new at this and greatly appreciate any
guidance!
I am using Word 2003 and when I run that macro I get the following error:
"Run time error 446. Object Does not support Named Arguements"
for the line:
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
"Graham Mayor" wrote:
> Does the following work for you?
>
> Sub SendDocumentAsAttachment()
> Dim bStarted As Boolean
> Dim oOutlookApp As Outlook.Application
> 'You'll need to add the Outlook Object Library to VBA Tools References
> Dim oItem As Outlook.MailItem
> On Error Resume Next
> If Len(ActiveDocument.Path) = 0 Then 'Document has not been saved
> ActiveDocument.Save 'so save it
> End If
> 'see if Outlook is running and if so turn your attention there
> Set oOutlookApp = GetObject(, "Outlook.Application")
> If Err <> 0 Then 'Outlook isn't running
> 'So fire it up
> Set oOutlookApp = CreateObject("Outlook.Application")
> bStarted = True
> End If
> 'Open a new e-mail message
> Set oItem = oOutlookApp.CreateItem(olMailItem)
> With oItem 'and add the detail to it
> .To = "someone@somewhere.com" 'send to this address
> .Subject = "New subject" 'This is the message subject
> .Body = "See attached document" ' This is the message body text
> .Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
> .Send
> '**********************************
> 'If you want to view the message before it goes
> 'change the line above from .Send to .Display
> 'Otherwise the message is sent straight to the Outbox
> 'and if you have Outlook set to send mail immediately,
> 'it will simply be Sent
> 'with no obvious sign that Outlook has operated.
> 'Apart from the copy in the Outlook Sent folder
> '**********************************
> End With
> If bStarted Then 'If the macro started Outlook, stop it again.
> oOutlookApp.Quit
> End If
> 'Clean up
> Set oItem = Nothing
> Set oOutlookApp = Nothing
> End Sub
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site
http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> PiaD wrote:
> > I need a macro that automatically sends the current active document
> > via email to one specific user. It sounds easy, but I have not found
> > anything that meets this exactly.
> >
> > Options I have found include: MsoEnvelope Object and SendForReview
> > Method. They provide the following hurdles: MsoEnvelope does not
> > send document as attachment, only the document content as the body of
> > the email. SendForReview sends the document with the Tracking status
> > ON, which I do NOT want. Any help overcoming this or any other
> > options to solve my issues would be great. I will take anyway to send
> > an attachment to a specified user.
> >
> > I have tried using:
> > Sub SendMail
> > With Application.ActiveDocument.MailEnvelope
> > .Introduction = "Please read this and send me your comments."
> > 'Return a Microsoft Outlook MailItem object that
> > 'you can use to send the document.
> > With .Item
> > .Recipients.Add "somebody@misc.com"
> > .Subject = "Here is the document."
> > 'The body of this message will be
> > 'the content of the active document.
> > .Send
> > End Sub
> >
> > OR
> >
> > Sub WebReview()
> > ThisDocument.SendForReview _
> > Recipients:="someone@example.com; amy jones", _
> > Subject:="Please review this document.", _
> > ShowMessage:=False, _
> > IncludeAttachment:=True
> > End Sub
>
>
>