BobApril
05-09-2001, 12:26 AM
I'm working on an MS Word macro to create a new e-mail in Outlook (or MAPI), attach a file to it, and send the file. It all appears to work correctly, but when I double-click on the attachment, I get an error message "The operation failed". I'm guessing that I need to set the format for the attachment, but I can't figure out how. Any ideas?
Mark Hall
BobApril
07-10-2001, 12:39 AM
Found the answer, and another question:
Well, I found a way to do it, form another source, like so:
Dim FindOutlook, Mailname, MakeMessage
Set FindOutlook = CreateObject("Outlook.Application")
Set MailName = FindOutlook.GetNameSpace("MAPI")
Mailname.Logon "profile", "password"
Set MakeMessage = FindOutlook.CreateItem(0)
MakeMessage.Recipients.Add "someone@somewhere.com"
MakeMessage.Subject = "My Subject Line"
MakeMessage.Body = "My Text Line"
MakeMessage.Attachments.Add "C:\MyFolder\Myfile.txt"
MakeMessage.Send
MailName.Logoff
So, anyway, now I'm trying to figure out how to add longer text to the body, multiple lines, and ideally, some sort of formatting (fonts, colors, bold, centered, etc.) Any ideas?
Mark Hall
jerryfchui
07-12-2001, 08:15 PM
Mark,
It is a great thing you could find those codes. I learnt from it too. To add longer text to the body is rather simple, maybe you've figured it out already. In short
replace yours
MakeMessage.Body = "My Text Line"
with
MakeMessage.Body = "My Text Line" + chr$(13) + _
"this can be a very long line" + chr$(13) + _
"this can be another long string/line"
chr$(13) is a carriage return character/string but I believe you could also use vb constant vbCrLf. I doubt if we coud have bold, colored Text, etc. If anyone has a definite answer, I'd like to know.
For me I will work around with an attached document, for instance, a MS word file.
fredriko
07-16-2001, 03:45 AM
I think you can use bold and underlined text but you would pass the text value to a RTF field instead of the text. I can't quite remember what the structure is as it's been a donkey's age since I did any of this work but I could did some code out (eventually) if ya want some?
Bringing it large to the Northern Lads and Lasses. Big Up!