Page 1 of 1 1
Topic Options
#178353 - 2007-07-25 02:45 AM Send email from Word document
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Does anybody know if sending an email with Word can be automated?
I have a form in Word that I would like to send automated, using the EnvelelopeVisible property.
I would like to:
  • add a recipient addres
  • add a subject
  • send the email

;Script Options
If Not @LOGONMODE
    Break On
Else
    Break Off
EndIf
Dim $RC
$RC = SetOption("Explicit", "On")
$RC = SetOption("NoMacrosInStrings", "On")
$RC = SetOption("NoVarsInStrings", "On")
If @SCRIPTEXE = "KIX32.EXE"
    $RC = SetOption("WrapAtEOL", "On")
EndIf

;Declare variables
Dim
$objWord

Dim $strFile

;Initialize variables
$objWord = CreateObject("Word.Application")
$strFile = "C:\Test\WordTemplate.dot"

;Code
$objWord.Visible = True
$RC = $objWord.documents.open($strFile)
$objWord.activewindow.EnvelopeVisible = True

Top
#178354 - 2007-07-25 03:02 AM Re: Send email from Word document [Re: Witto]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Can be sent, but Outlook client will ask if it's okay to send the mail.

We bought this little tool to get past it on a couple of our systems. You could probably get Autoit to do it for you but I didn't have time to look into it and code anything. This was cheaper than me messing around with it.

http://www.contextmagic.com/express-clickyes/

Top
#178359 - 2007-07-25 08:32 AM Re: Send email from Word document [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
witto, why would you have form in word?
_________________________
!

download KiXnet

Top
#178360 - 2007-07-25 09:06 AM Re: Send email from Word document [Re: Lonkero]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Doc,
I don't think I need the ClickYes yet. Thanks anyway. I just wanted to know if I could send or at least fill in items like the recipient and the subject, just to avoid errors and to speeed up sending mail
Jooel,
The Word document in this example is just a test. But I was thinking about a form that has to be filled in (you know about the forms toolbar?)

Top
#178366 - 2007-07-25 09:39 AM Re: Send email from Word document [Re: Witto]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I think I am getting a littlebit further
 Code:
$objWord.ActiveDocument.MailEnvelope.Item.to = "John.Doe@Company.ext"
$objWord.ActiveDocument.MailEnvelope.Item.Subject = "Hello World"

Top
#178367 - 2007-07-25 09:41 AM Re: Send email from Word document [Re: Witto]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I was more thinking about a asp page on your server.
but even on wksta, you can use kixtart+ie+blat to do the stuff.
right?
_________________________
!

download KiXnet

Top
#178379 - 2007-07-25 11:31 AM Re: Send email from Word document [Re: Lonkero]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Yep I've done that before.
Top
#178430 - 2007-07-26 01:01 AM Re: Send email from Word document [Re: NTDOC]
totalnewbie Offline
Lurker

Registered: 2007-07-25
Posts: 1
I am a little confused about why you need the setup you describe Witto. It is possible to use Word to compose e-mails within Outlook (either as standard or for individual messages), surely this allows you to use your form?

I don't have Outlook installed on the machine I'm using now, but I'll do a bit of reasearch for you at work tomorrow.

Top
#178441 - 2007-07-26 09:40 AM Re: Send email from Word document [Re: totalnewbie]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I want to use a form that I created in Word. I think I will stick to VBA and some macro's in my template. Thanks anyway for your reply.
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1114 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.196 seconds in which 0.165 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org