Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > Need Help with outlook


Reply
 
Thread Tools Display Modes
  #1  
Old 11-06-2003, 09:04 AM
QuantumCat's Avatar
QuantumCat QuantumCat is offline
Senior Contributor
 
Join Date: Aug 2003
Location: Dordrecht,Holland
Posts: 858
Default Need Help with outlook


I want to automize emailing , or more precific: on event emailing
if someting then email ...

I'm having trouble with the code

I can't remember the code exactly, but ist is similar to what you do with word and excel, but not quite.

it all falls down at the it's the "not quite" part
I can open an outlook session
I can add a recipient -even by only using the adressbook name
I can add a subject and I can send the email

I can't figure out how to creat a text body -the only "body" property I can find is only capable of creating single line emails.

I would like to create something like:

Code:
for i = 1 to NrOfMembers emailObject.Recipient = mailinglistmember(i).email emailObject.Subject = "N11 Touring Dates" emailObject.body = Dear & mailinglistmember(i).name I hereby send you the following lists of the N11 gigs for next month" (toggleBold) [b]date location time[/b] gig(1).date & TAB & gig(1).location & TAB & gig(1).time gig(2).date & TAB & gig(1).location & TAB & gig(1).time gig(3).date & TAB & gig(1).location & TAB & gig(1).time gig(4).date & TAB & gig(1).location & TAB & gig(1).time We hope te see you at any of these gigs Yours sincerely N11 forum administrator next i

what I also would like is to make the email visible before sensing so I can see what is happening.

Can anyone help me?
Reply With Quote
  #2  
Old 11-06-2003, 09:17 AM
QuantumCat's Avatar
QuantumCat QuantumCat is offline
Senior Contributor
 
Join Date: Aug 2003
Location: Dordrecht,Holland
Posts: 858
Default add.

forgot the
Code:
emailObject.send

before the "next i"

QC
Reply With Quote
  #3  
Old 11-06-2003, 09:52 AM
Wamphyri's Avatar
Wamphyri Wamphyri is offline
Variable not defined

Retired Moderator
* Guru *
 
Join Date: Apr 2002
Location: Ottawa, Ontario
Posts: 4,793
Default

You need to use vbCrLf where you want the end of a line to be.
For example:
emailObject.body = "Hello" & vbCrLf & vbCrLf & "This is a test!"

would produce:
Hello

This is a test!
__________________
-Carl
Reply With Quote
  #4  
Old 11-06-2003, 10:04 AM
QuantumCat's Avatar
QuantumCat QuantumCat is offline
Senior Contributor
 
Join Date: Aug 2003
Location: Dordrecht,Holland
Posts: 858
Default

thnx!

Quote:
Originally Posted by Wamphyri
You need to use vbCrLf where you want the end of a line to be.
For example:
emailObject.body = "Hello" & vbCrLf & vbCrLf & "This is a test!"

would produce:
Hello

This is a test!

Reply With Quote
  #5  
Old 11-07-2003, 03:29 AM
JordanChris JordanChris is offline
Senior Contributor

* Expert *
 
Join Date: Jan 2003
Location: Newbury, UK
Posts: 1,092
Default

And you can use .Display rather than .Send to show the message.
Reply With Quote
  #6  
Old 11-09-2003, 02:49 AM
QuantumCat's Avatar
QuantumCat QuantumCat is offline
Senior Contributor
 
Join Date: Aug 2003
Location: Dordrecht,Holland
Posts: 858
Default How to integrate database data

The body tip with vbCrLf works nicely, but I still can't figure out how to fill the body with database data ...
I'm thinking of a table and fill it or use tabs:
Code:
for i = 1 to NrRows Do for J = 1 to NrColumsn do oMail.someting = a(i,j).text & vbTab & CrLf next j next i

QC
Reply With Quote
  #7  
Old 11-10-2003, 05:04 AM
JordanChris JordanChris is offline
Senior Contributor

* Expert *
 
Join Date: Jan 2003
Location: Newbury, UK
Posts: 1,092
Default

Sounds OK. But don't forget you may need to have:

oMail.Body = oMail.Body & <<the next line>>
Reply With Quote
  #8  
Old 11-11-2003, 03:51 AM
QuantumCat's Avatar
QuantumCat QuantumCat is offline
Senior Contributor
 
Join Date: Aug 2003
Location: Dordrecht,Holland
Posts: 858
Default

doesn't work, i get an error -someting about wrong number of arguments

Code:
myrange = "something" & vbCrLf myrange = myrange & "something else" & vbCrLf for i =1 to all myrange = myrange & databese(i).item & vbCrLf next i myrange = vbCrLf& myrange & "something else" & vbCrLf

but thats' not what i had in mind though ... sadly

Does anyone know how to insert documents or sheets into an outlook email?
I saw " insert" in the top down menu:
insert
object
word doc / excel sheet /pps

Now If this can be done by hand-I'll bet ik can be done automatically with VB!!





Quote:
Originally Posted by JordanChris
Sounds OK. But don't forget you may need to have:

oMail.Body = oMail.Body & <<the next line>>

Reply With Quote
  #9  
Old 11-11-2003, 02:36 PM
JordanChris JordanChris is offline
Senior Contributor

* Expert *
 
Join Date: Jan 2003
Location: Newbury, UK
Posts: 1,092
Default

I can't see why (assume: MyRange is a string) any of those lines would give a "wrong number of arguments". Maybe this line is wrong??: For i =1 To all

By "insert" do you mean Add Attachment??
Reply With Quote
  #10  
Old 11-12-2003, 05:08 AM
QuantumCat's Avatar
QuantumCat QuantumCat is offline
Senior Contributor
 
Join Date: Aug 2003
Location: Dordrecht,Holland
Posts: 858
Default

Well vb highlights the "body" part ...
Uhmm ... I think it's because I tried to more than one oMail.body () 's in one statement
Quote:
Originally Posted by JordanChris
I can't see why (assume: MyRange is a string) any of those lines would give a "wrong number of arguments". Maybe this line is wrong??: For i =1 To all

By "insert" do you mean Add Attachment??

Reply With Quote
  #11  
Old 11-12-2003, 05:47 AM
galaganut galaganut is offline
Regular
 
Join Date: Oct 2003
Posts: 88
Default

What exactly do you want to insert into the body of the email? I found a great macro that takes a specified range in excel and converts it to html (keeping all the formatting) and makes the html the body of the email. Are you looking for something like that? I think it would apply equally well to word files as long as they were saved as html files.

Galaganut
Reply With Quote
  #12  
Old 11-12-2003, 03:44 PM
QuantumCat's Avatar
QuantumCat QuantumCat is offline
Senior Contributor
 
Join Date: Aug 2003
Location: Dordrecht,Holland
Posts: 858
Default

what exactly is a list with a number of rows and a number of columns,
in order to align all these preferably a table i guess

I can export these things to word, and if needs be to excel as well

Quote:
Originally Posted by galaganut
What exactly do you want to insert into the body of the email? I found a great macro that takes a specified range in excel and converts it to html (keeping all the formatting) and makes the html the body of the email. Are you looking for something like that? I think it would apply equally well to word files as long as they were saved as html files.

Galaganut

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2000 Contact Items, Deleted items and Address Books hitchhiker General 0 10-14-2003 07:03 AM
Sorting messages in Outlook 2000 CodeOptimist Word, PowerPoint, Outlook, and Other Office Products 0 06-26-2003 10:32 PM
New problem when import .CSV file which is exported by Outlook LoveVB99 File I/O and Registry 2 06-13-2003 12:15 AM
Web server reboot and Outlook Objects jdirienzi Word, PowerPoint, Outlook, and Other Office Products 2 10-23-2002 08:02 AM
Outlook XP and Word Editor question hongman Word, PowerPoint, Outlook, and Other Office Products 1 04-22-2002 07:00 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->