A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Writing text to the "read message"



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 2nd 09, 09:59 PM posted to microsoft.public.outlook.program_vba
cmonroe21
external usenet poster
 
Posts: 5
Default Writing text to the "read message"

Hi there. I have a project that I have been unable to get help on, so I went
out and bought MS Outlook 2007 Programming the book, and am still having
problems

What I'm doing here is creating an email with a number of fields and controls
for the composer to use. The recipient of this email is going to be a
computer that can extract data from text in the email message box. So, I
need to be able to print the user-selected contents of the controls (via .
Value or .Text ???) in text form onto the "read message" email message. The
forms are created, I just don't know how to access the Read Message box.

Thank you so much! I look forward to hearing from you!

  #2  
Old January 3rd 09, 06:39 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Writing text to the "read message"

If this code is running in the form then use Item.Body for the plain text
contents and Item.HTMLBody for any HTML contents (which must be in correct
HTML syntax).

If the code is running in the Outlook VBA project or elsewhere and the email
where you want to place the text is the ActiveInspector then use
Application.ActiveInspector.CurrentItem.Body or .HTMLBody. With standalone
or COM addin code instantiate an Outlook.Application object (in a COM addin
from the trusted Application object that's passed to you) and use that
instead of Application.

Which book did you buy?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"cmonroe21" u48566@uwe wrote in message news:8f9973dd2558a@uwe...
Hi there. I have a project that I have been unable to get help on, so I
went
out and bought MS Outlook 2007 Programming the book, and am still having
problems

What I'm doing here is creating an email with a number of fields and
controls
for the composer to use. The recipient of this email is going to be a
computer that can extract data from text in the email message box. So, I
need to be able to print the user-selected contents of the controls (via .
Value or .Text ???) in text form onto the "read message" email message.
The
forms are created, I just don't know how to access the Read Message box.

Thank you so much! I look forward to hearing from you!


  #3  
Old January 6th 09, 06:50 PM posted to microsoft.public.outlook.program_vba
cmonroe21 via OfficeKB.com
external usenet poster
 
Posts: 53
Default Writing text to the "read message"

I bought Microsoft Outlook 2007 Programming. It's a good book, but I needed
to be able to create a compose message that was a form with text boxes and
comboboxes, and a read message that was a regular email message with the info
from the controls printed in plain text, and it wasn't easy to find the exact
answers I was looking for. But I found MSDN.microsoft.com and was able to
get tons of info pertinent to my project. I've decided to go with the MS Vba
editor rather than using the Outlook script editor, and I've decided to
(instead of messing with the "compose" message vs. "read" message, and the
Message and P.2 tabs) go with a form that sends a MailItem on a command
button click.

BUT... my NEXT question... (you still think you wanna help?!) I need to get
this new MailItem into a basic font so that I can use tabs and have the data
line up nicely. I tried using & vbTab, but it just adds 5 spaces, so the
data is still not very pretty. I also tried lining them up via spaces (as
you can see below) but again, not pretty. What's important is that the data
starts on the same space in each line (that's how the software I'm sending
the message to will extract it), but I also want it to look pretty. So, I
need to get it into, oh I don't know what you call it... a font where each
character takes up the same amount of space. A monospace font? But I need
to be able to modify the font of the newly created outgoing MailItem. Got
any suggestions?

Here's the code of the command button:

Private Sub cmdSendSub_Click()
'FYI prefix txt denotes a textbox, cmb a combobox
Dim NewEmail As Outlook.MailItem
On Error Resume Next 'do I need this? How does the "Next" work?
Set NewEmail = Application.CreateItem(olMailItem)
NewEmail.To = txtTo.Text
NewEmail.Subject = txtSubject.Text

'Add attachment to email later (NewEmail.Attachments.Add ??)
'...as you can see, my next question will address an attachment

'Set font of NewEmail

NewEmail.Body = _
"Date: " & txtDate.Text & vbCrLf & _
"Campus: " & cmbCampus.Text & vbCrLf & _
"Trans Type: " & cmbTransType.Text & vbCrLf & _
"Post Value: " & txtPost.Text & vbCrLf & _
"Adj Value: " & txtAdjustment.Text & vbCrLf & _
"Total: " & txtTotal.Text & vbCrLf
NewEmail.Send
End Sub


Wow. See, even here they do not line up (they were lined up in the Vba
Editor). Hmph.



Ken Slovak - [MVP - Outlook] wrote:
If this code is running in the form then use Item.Body for the plain text
contents and Item.HTMLBody for any HTML contents (which must be in correct
HTML syntax).

If the code is running in the Outlook VBA project or elsewhere and the email
where you want to place the text is the ActiveInspector then use
Application.ActiveInspector.CurrentItem.Body or .HTMLBody. With standalone
or COM addin code instantiate an Outlook.Application object (in a COM addin
from the trusted Application object that's passed to you) and use that
instead of Application.

Which book did you buy?

Hi there. I have a project that I have been unable to get help on, so I
went

[quoted text clipped - 11 lines]

Thank you so much! I look forward to hearing from you!


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200901/1

  #4  
Old January 6th 09, 07:33 PM posted to microsoft.public.outlook.program_vba
cmonroe21 via OfficeKB.com
external usenet poster
 
Posts: 53
Default Writing text to the "read message"

I'm going to post this as a new thread, too.

cmonroe21 wrote:
I bought Microsoft Outlook 2007 Programming. It's a good book, but I needed
to be able to create a compose message that was a form with text boxes and
comboboxes, and a read message that was a regular email message with the info
from the controls printed in plain text, and it wasn't easy to find the exact
answers I was looking for. But I found MSDN.microsoft.com and was able to
get tons of info pertinent to my project. I've decided to go with the MS Vba
editor rather than using the Outlook script editor, and I've decided to
(instead of messing with the "compose" message vs. "read" message, and the
Message and P.2 tabs) go with a form that sends a MailItem on a command
button click.

BUT... my NEXT question... (you still think you wanna help?!) I need to get
this new MailItem into a basic font so that I can use tabs and have the data
line up nicely. I tried using & vbTab, but it just adds 5 spaces, so the
data is still not very pretty. I also tried lining them up via spaces (as
you can see below) but again, not pretty. What's important is that the data
starts on the same space in each line (that's how the software I'm sending
the message to will extract it), but I also want it to look pretty. So, I
need to get it into, oh I don't know what you call it... a font where each
character takes up the same amount of space. A monospace font? But I need
to be able to modify the font of the newly created outgoing MailItem. Got
any suggestions?

Here's the code of the command button:

Private Sub cmdSendSub_Click()
'FYI prefix txt denotes a textbox, cmb a combobox
Dim NewEmail As Outlook.MailItem
On Error Resume Next 'do I need this? How does the "Next" work?
Set NewEmail = Application.CreateItem(olMailItem)
NewEmail.To = txtTo.Text
NewEmail.Subject = txtSubject.Text

'Add attachment to email later (NewEmail.Attachments.Add ??)
'...as you can see, my next question will address an attachment

'Set font of NewEmail

NewEmail.Body = _
"Date: " & txtDate.Text & vbCrLf & _
"Campus: " & cmbCampus.Text & vbCrLf & _
"Trans Type: " & cmbTransType.Text & vbCrLf & _
"Post Value: " & txtPost.Text & vbCrLf & _
"Adj Value: " & txtAdjustment.Text & vbCrLf & _
"Total: " & txtTotal.Text & vbCrLf
NewEmail.Send
End Sub

Wow. See, even here they do not line up (they were lined up in the Vba
Editor). Hmph.

If this code is running in the form then use Item.Body for the plain text
contents and Item.HTMLBody for any HTML contents (which must be in correct

[quoted text clipped - 14 lines]

Thank you so much! I look forward to hearing from you!


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200901/1

  #5  
Old January 6th 09, 10:23 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Writing text to the "read message"

Not quite, you posted this in the same thread as before.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"cmonroe21 via OfficeKB.com" u48566@uwe wrote in message
news:8fca76f460b60@uwe...
I'm going to post this as a new thread, too.


  #6  
Old January 6th 09, 10:29 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Writing text to the "read message"

Plain text is almost impossible to align correctly and unless you're using
WordMail and use the Word object model to format things you can't even
access things like font, etc. in a plain text message. For that you'd use
Inspector.WordEditor which is a Word.Document object.

If it's HTML then you use Inspector.HTMLEditor and that's an IHTMLDocument
object and then you'd use syntactically correct HTML to set things.

For RTF you really need to be deep into knowing RTF codes so that's not a
path I'd take.

That's it for the Outlook object model.

Probably the best way is to format things as a Word table and use WordMail
to get things nicely aligned as you want.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"cmonroe21 via OfficeKB.com" u48566@uwe wrote in message
news:8fca171b5f678@uwe...
I bought Microsoft Outlook 2007 Programming. It's a good book, but I
needed
to be able to create a compose message that was a form with text boxes and
comboboxes, and a read message that was a regular email message with the
info
from the controls printed in plain text, and it wasn't easy to find the
exact
answers I was looking for. But I found MSDN.microsoft.com and was able to
get tons of info pertinent to my project. I've decided to go with the MS
Vba
editor rather than using the Outlook script editor, and I've decided to
(instead of messing with the "compose" message vs. "read" message, and the
Message and P.2 tabs) go with a form that sends a MailItem on a command
button click.

BUT... my NEXT question... (you still think you wanna help?!) I need to
get
this new MailItem into a basic font so that I can use tabs and have the
data
line up nicely. I tried using & vbTab, but it just adds 5 spaces, so the
data is still not very pretty. I also tried lining them up via spaces (as
you can see below) but again, not pretty. What's important is that the
data
starts on the same space in each line (that's how the software I'm sending
the message to will extract it), but I also want it to look pretty. So, I
need to get it into, oh I don't know what you call it... a font where each
character takes up the same amount of space. A monospace font? But I
need
to be able to modify the font of the newly created outgoing MailItem. Got
any suggestions?

Here's the code of the command button:

Private Sub cmdSendSub_Click()
'FYI prefix txt denotes a textbox, cmb a combobox
Dim NewEmail As Outlook.MailItem
On Error Resume Next 'do I need this? How does the "Next" work?
Set NewEmail = Application.CreateItem(olMailItem)
NewEmail.To = txtTo.Text
NewEmail.Subject = txtSubject.Text

'Add attachment to email later (NewEmail.Attachments.Add ??)
'...as you can see, my next question will address an attachment

'Set font of NewEmail

NewEmail.Body = _
"Date: " & txtDate.Text & vbCrLf & _
"Campus: " & cmbCampus.Text & vbCrLf & _
"Trans Type: " & cmbTransType.Text & vbCrLf & _
"Post Value: " & txtPost.Text & vbCrLf & _
"Adj Value: " & txtAdjustment.Text & vbCrLf & _
"Total: " & txtTotal.Text & vbCrLf
NewEmail.Send
End Sub


Wow. See, even here they do not line up (they were lined up in the Vba
Editor). Hmph.


  #7  
Old January 7th 09, 04:30 PM posted to microsoft.public.outlook.program_vba
cmonroe21 via OfficeKB.com
external usenet poster
 
Posts: 53
Default Writing text to the "read message"

Thanks so much for your help!

Ken Slovak - [MVP - Outlook] wrote:
Plain text is almost impossible to align correctly and unless you're using
WordMail and use the Word object model to format things you can't even
access things like font, etc. in a plain text message. For that you'd use
Inspector.WordEditor which is a Word.Document object.

If it's HTML then you use Inspector.HTMLEditor and that's an IHTMLDocument
object and then you'd use syntactically correct HTML to set things.

For RTF you really need to be deep into knowing RTF codes so that's not a
path I'd take.

That's it for the Outlook object model.

Probably the best way is to format things as a Word table and use WordMail
to get things nicely aligned as you want.

I bought Microsoft Outlook 2007 Programming. It's a good book, but I
needed

[quoted text clipped - 54 lines]
Wow. See, even here they do not line up (they were lined up in the Vba
Editor). Hmph.


--
Message posted via http://www.officekb.com

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I receive "could not read the calendar" error message Remodeler Outlook - Calandaring 16 October 30th 08 07:58 PM
Can not add CommandBar if "Word 2003 to read Rich Text e-mail" isselected. [email protected] Add-ins for Outlook 6 October 16th 08 03:54 PM
Why would a message change from "read" back to "unread" in Outlook? Alan Outlook - General Queries 5 October 14th 08 08:28 AM
Outlook: "Mark as read" a message with a single keyboard shortcut? Luca Villa Outlook - General Queries 3 August 13th 07 06:02 PM
Rule with criteria "Message Read" [email protected] Outlook - General Queries 8 July 16th 06 10:14 PM


All times are GMT +1. The time now is 01:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.