Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

Email Word Document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim - 20 Oct 2007 17:17 GMT
Thank you in advance for your time.

I have a button at the bottom of my Word document that reads "SUBMIT" When I
click the button, is there anyway it could email itself to a particular
person?  

It keeps prompting me to enter the email address.  I'm trying to get around
it so I don't have to type the address in everytime I submit.

I do appreciate your time.

thanks,
tim

tim
Graham Mayor - 21 Oct 2007 06:08 GMT
The following will work - enter your address, subject and body text where
indicated.

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

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Thank you in advance for your time.
>
[quoted text clipped - 11 lines]
>
> tim
Tim - 21 Oct 2007 13:04 GMT
Hi Graham.

Thank you for your time.  Your code is quit impressive.  

I can not get it to work though.... on the first few lines of code is says
compile error.  

Would it be becuase I'm in Word 2000?  

Anyway, I do thank you.  Your code was way good.

thanks again.
Tim

> The following will work - enter your address, subject and body text where
> indicated.
[quoted text clipped - 49 lines]
> >
> > tim
Graham Mayor - 21 Oct 2007 14:53 GMT
Open the vba editor and under tools > references, check the Outlook object
library.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi Graham.
>
[quoted text clipped - 71 lines]
>>>
>>> tim
Tim - 21 Oct 2007 17:08 GMT
Graham your gonna hate me for this...I got the Library checked like you
said...thank you.  

It started to work until I found out I had Outlook Express.  I'm sorry dam'it.

I tried to change a couple of things in the code myself to see if I could
avoid bothering you again.

If you feel like helping me anymore, well... that would be nice...I
appreciate all you have done already.  Again I was very impressed with the
code.  I could have never figured that out!!!  How did you learn so much?

Thanks again Graham.

tim

> Open the vba editor and under tools > references, check the Outlook object
> library.
[quoted text clipped - 74 lines]
> >>>
> >>> tim
Russ - 21 Oct 2007 22:06 GMT
Tim,
I'm, at this moment at home, using MacWord. But if I were you, I would try
substituting combinations of spelling of Outlook Express in the two places
where Graham had the exact phrase "Outlook.Application" and see if one way
of spelling it worked.
I.e.
"Outlook Express.Application"
"Outlook_Express.Application"
"OutlookExpress.Application"

> Graham your gonna hate me for this...I got the Library checked like you
> said...thank you.
[quoted text clipped - 90 lines]
>>>>>
>>>>> tim

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Tim - 22 Oct 2007 06:01 GMT
Hi Russ...I first just want to thank you both again for your expertise.

Yes sir Russ, I did try that very exact thing you just mentioned.  I didn't
want to be abother any more and that is why I tried a few different things.  
I was my bad in the beginng for not knowing the right application.  I'm have
to use both and just did't get it right.

Sorry and thank you all again.

> Tim,
> I'm, at this moment at home, using MacWord. But if I were you, I would try
[quoted text clipped - 100 lines]
> >>>>>
> >>>>> tim
Graham Mayor - 22 Oct 2007 06:36 GMT
I do not believe Outlook Express (unlike Outlook) is programmable from
within Word.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi Russ...I first just want to thank you both again for your
> expertise.
[quoted text clipped - 126 lines]
>>
>>  drsmN0SPAMikleAThotmailD0Tcom.INVALID
Tim - 22 Oct 2007 07:49 GMT
Thanks for the Tip Graham...You have been beyond helpful my friend.  Thank
you so much :)

> I do not believe Outlook Express (unlike Outlook) is programmable from
> within Word.
[quoted text clipped - 129 lines]
> >>
> >>  drsmN0SPAMikleAThotmailD0Tcom.INVALID
Graham Mayor - 22 Oct 2007 10:23 GMT
You are welcome :)

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Thanks for the Tip Graham...You have been beyond helpful my friend.
> Thank you so much :)
[quoted text clipped - 141 lines]
>>>>
>>>>  drsmN0SPAMikleAThotmailD0Tcom.INVALID
Tim - 22 Oct 2007 06:06 GMT
I know this was going to be harder than I expected.  

> Tim,
> I'm, at this moment at home, using MacWord. But if I were you, I would try
[quoted text clipped - 100 lines]
> >>>>>
> >>>>> tim

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.