Getting ASCII Text From A Outlook Form

G

Guest

We are trying to use a Outlook Form for our organization to submit
project/help requests via email. We use Trackit 6.5 for our helpdesk
software. Trackit automatically will pull the information that is submitted
via email and create a Helpdesk Work Order. The problem is, it will only
read ASCII TEXT (Plain Text) from this email. When the form is submitted, it
is unable to read any information within that email.

Is there a way to have the form just be read in plain text, no form
information on the receiving end. I have tried everything, but it still
shows up like a form. When you print a form, it prints plain ASCII, this
would be perfect to get dumped in the receiving email.

Any help would be appreciated, thanks!
 
S

Sue Mosher [MVP-Outlook]

If you've already designed a message form for this, use code in its Item_Send event handler to create a new message and populate its body with the data from the fields on the custom form, then cancel the sending of the original by setting Item_Send = False.
 
G

Guest

Dear Sue,

I have 1-2 hours of experience with Outlook Forms, I get the gist of what
you are saying, but will need HAND-HOLDING instructions. Do you have any DOC
references to what you are saying? Also, is this in your book - we bought
the other one, and are finding it confusing - we will be buying yours!

Also, do you know of any good VIDEO training out there for sale that covers
Outlook Form Programming?

Thanks for all your help.

Sincerely,
Steve Flater
 
S

Sue Mosher [MVP-Outlook]

There's not much to it, something like:

Function Item_Send()
Const olFormatPlain = 1
Const olDiscard = 1

Set NewMail = Application.CreateItem(0)
NewMail.BodyFormat = olFormatPlain

' transfer subject
NewMail.Subject = Item.Subject

' transfer recipients
For Each objRecip in Item.Recipients
NewMail.Recipients.Add objRecip.Address
Next

' build body from custom fields
strBody = "First Field: " & _
Item.UserProperties("First Field") & vbCrLf & _
"2nd Field:" & _
Item.UserProperties("2nd Field")
' etc. for as many properties as you need
NewMail.Body = strBody

' send it
NewMail.Send

' discard the original
Item_Send = False
Set insp = Item.GetInspector
insp.Close olDiscard
End Function

Listing 20.12 in my book is a slightly more elegant version. You can download the code from http://www.outlookcode.com. Click the 'get the code' link.

I know of no video training on Outlook forms. I am hoping to do some little LiveMeeting web casts when I get caught up on some other things.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Dear Sue,

I will give it a try tomorrow when I am at the Salt Mine and getting paid
for working. I will let you know how it goes, thanks for all your help!

Sincerely,
Steve Flater
 
G

Guest

Dear Sue,

I added this code and modified the fields to match my fields. Nothing seems
to happen differently than before. The form is still being sent. Do you
offer consulting services or anything, I would like to talk to you either via
email or phone. Please let me know, thanks!

OH YES, we did buy your book too. It looks wonderful, but I do not have
time to read it all cover to cover.

Thanks for all your help.

Sincerely,
Steve Flater
 
S

Sue Mosher [MVP-Outlook]

Where did you publish the form? Does any code run on the form at all?

Sorry, but I don't do telephone consulting and have a full schedule of engagements. as with everyone answering questions here, this is all volunteer time.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Dear Sue,

I tried publishing it to Personal Forms, and just saving it as a file.
Either method does not appear to work. I am not getting any error messages
or "weirdness" it just sends the original form as before. Just so we are
clear, I am using a Message Form, not a POST form. Here is the code that I
modified and am trying to test:

Function Item_Send()
Const olFormatPlain = 1
Const olDiscard = 1

Set NewMail = Application.CreateItem(0)
NewMail.BodyFormat = olFormatPlain

' transfer subject
NewMail.Subject = Item.Subject

' transfer recipients
For Each objRecip in Item.Recipients
NewMail.Recipients.Add objRecip.Address
Next

' build body from custom fields
strBody = "Department: " & _
Item.UserProperties("DepartmentBox") & vbCrLf & _
"Request Type:" & _
Item.UserProperties("RequestTypeBox")
' etc. for as many properties as you need
NewMail.Body = strBody

' send it
NewMail.Send

' discard the original
Item_Send = False
Set insp = Item.GetInspector
insp.Close olDiscard
End Function

I am entering this code in when in Design A Form mode, with the actual form
- by selecting the View Code, then the script editor pops up.

I am using Outlook 2003 SP1 against a Exchange 2003 SP1.

Is there something easy that I am missing? Please let me know, and thanks
for all of your help!!!

Sincerely,
Steve Flater
 
S

Sue Mosher [MVP-Outlook]

Again, does any code on the published form run at all? Try putting a Msgbox statement in the Item_Open event handler.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Dear Sue,

Sorry, YES - I added a MsgBox and it does come up when opening the form. It
only does this when I open the Published Form from the Personal Forms. I do
not get the MsgBox when I open the form from a saved file. (Do you know why
that would be, the MsgBox opens from a published form, but not a file.)???

But, ultimately, the Plain Text part is not working. Do you have more
thoughts on that?

Sincerely,
Steve Flater
 
S

Sue Mosher [MVP-Outlook]

Code does not run on unpublished or other one-off forms. See http://www.outlookcode.com/d/secforms.htm

Since you've confirmed that the form is running, I'd suggest that you step through it in the script debugger so you can give us more information about what might be happening when the code executes.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Dear Sue,

OK, I have made some progress fumbling around with this, I now am able to
send a plain text email, but the only data going thru is the sender and
subject. It is not grabbing any data from the form and putting it into the
plain text email. Can you review this code and let me know whats missing???
Thanks!

Function Item_Send()
Const olFormatPlain = 1
Const olDiscard = 1

Set NewMail = Application.CreateItem(olFormatPlain)
NewMail.BodyFormat = olFormatPlain

' transfer subject
NewMail.Subject = Item.Subject

' transfer recipients
For Each objRecip in Item.Recipients
NewMail.Recipients.Add objRecip.Address
Next

' build body from custom fields
strBody = "Department: " & _
Item.UserProperties("Department") & vbCrLf & _
"Request Type:" & _
Item.UserProperties("ProjectType")
' etc. for as many properties as you need
NewMail.Body = strBody

' send it
NewMail.Send

' discard the original
Item_Send = False
Set insp = Item.GetInspector
insp.Close olDiscard
End Function
 
S

Sue Mosher [MVP-Outlook]

This statement is incorrect and would create an appointment not a message:

Set NewMail = Application.CreateItem(olFormatPlain)

Since you want to create a message, it should be:

Const olMailItem = 0
Set NewMail = Application.CreateItem(olMailItem)

You could also use:

Set NewMail = Application.CreateItem(0)

as you had it earlier.

If you put in a MsgBox strBody statement before the statement that sets NewMail.Body, does the text look OK in the message box that pops up?
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

No, I see no problem. That's why I suggested that you use MsgBox strBody to examine the text.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top