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 - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Best way to get data from Item before send?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 5th 06, 12:17 AM posted to microsoft.public.outlook.program_forms
djohnson
external usenet poster
 
Posts: 6
Default Best way to get data from Item before send?

Hello, I'm now on my first custom Outlook Form. It's nothing fancy.
It's just code on the sender's end. So I am using olMailItem to send
mail to avoid sending the entire form so the recipient does not get a
"cannot view in the reading pane" message. I've just added a few
fields to the Message Form that transfer selection to the text in the
body. That is working fine. The problem happens during the send
command.

On computers other than my own, on a seemingly sporadic basis, they get
the error "outlook does not recognize one or more names" I have read
about this possibly being a corrupt address book problem, but I don't
know if that is the case. I think there might be something wrong with
my code. I'm particularly uncertain about "olmail.To = Item.To" and
"olmail.CC = Item.CC". Can I do that? If not, how? If this does
involve the address book is it possible to detect which names are not
being found?

Another big question is, is there any better way to avoid receipients
getting a message about code in their reading pane than what I'm doing?

Anyway, here is what I'm doing... maybe someone could point me in the
right direction?



Function Item_Send()
'On Error Resume Next
Set olapp = CreateObject("Outlook.Application")
Set olmail = olapp.CreateItem(olMailItem)
With olMail
olmail.To = Item.To
olmail.CC = Item.CC
olmail.Subject = Item.Subject
olmail.body = Item.Body
olmail.Send
End With

Set objInsp = Item.GetInspector
objInsp.Close 1
End Function

Ads
  #2  
Old August 7th 06, 05:07 PM posted to microsoft.public.outlook.program_forms
djohnson
external usenet poster
 
Posts: 6
Default Best way to get data from Item before send?

I would like to add a couple things....

The main problem is the error "could not recognize one or more names".
If the error is in fact a result of PST file corruption I am not sure
how to run scanpst.exe when, in our case, there is not local PST file
that I can find since the information is stored on the Exchange server.
Could someone tell me what file should be scanned? Thank you...



djohnson wrote:
Hello, I'm now on my first custom Outlook Form. It's nothing fancy.
It's just code on the sender's end. So I am using olMailItem to send
mail to avoid sending the entire form so the recipient does not get a
"cannot view in the reading pane" message. I've just added a few
fields to the Message Form that transfer selection to the text in the
body. That is working fine. The problem happens during the send
command.

On computers other than my own, on a seemingly sporadic basis, they get
the error "outlook does not recognize one or more names" I have read
about this possibly being a corrupt address book problem, but I don't
know if that is the case. I think there might be something wrong with
my code. I'm particularly uncertain about "olmail.To = Item.To" and
"olmail.CC = Item.CC". Can I do that? If not, how? If this does
involve the address book is it possible to detect which names are not
being found?

Another big question is, is there any better way to avoid receipients
getting a message about code in their reading pane than what I'm doing?

Anyway, here is what I'm doing... maybe someone could point me in the
right direction?



Function Item_Send()
'On Error Resume Next
Set olapp = CreateObject("Outlook.Application")
Set olmail = olapp.CreateItem(olMailItem)
With olMail
olmail.To = Item.To
olmail.CC = Item.CC
olmail.Subject = Item.Subject
olmail.body = Item.Body
olmail.Send
End With

Set objInsp = Item.GetInspector
objInsp.Close 1
End Function


  #3  
Old August 8th 06, 10:56 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Best way to get data from Item before send?

Instead of using To, you should call Item.Recipients.ResolveAll on the
original item, and if that returns True, iterate the Item.Recipients
collection and create matchin recipients on the new outgoing item.

Never use CreateObject to create a new Outlook.Application object in your
custom form code. Use the intrinsic Application object that is already
available to you.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



"djohnson" wrote:

I would like to add a couple things....

The main problem is the error "could not recognize one or more names".
If the error is in fact a result of PST file corruption I am not sure
how to run scanpst.exe when, in our case, there is not local PST file
that I can find since the information is stored on the Exchange server.
Could someone tell me what file should be scanned? Thank you...

djohnson wrote:
Hello, I'm now on my first custom Outlook Form. It's nothing fancy.
It's just code on the sender's end. So I am using olMailItem to send
mail to avoid sending the entire form so the recipient does not get a
"cannot view in the reading pane" message. I've just added a few
fields to the Message Form that transfer selection to the text in the
body. That is working fine. The problem happens during the send
command.

On computers other than my own, on a seemingly sporadic basis, they get
the error "outlook does not recognize one or more names" I have read
about this possibly being a corrupt address book problem, but I don't
know if that is the case. I think there might be something wrong with
my code. I'm particularly uncertain about "olmail.To = Item.To" and
"olmail.CC = Item.CC". Can I do that? If not, how? If this does
involve the address book is it possible to detect which names are not
being found?

Another big question is, is there any better way to avoid receipients
getting a message about code in their reading pane than what I'm doing?

Anyway, here is what I'm doing... maybe someone could point me in the
right direction?



Function Item_Send()
'On Error Resume Next
Set olapp = CreateObject("Outlook.Application")
Set olmail = olapp.CreateItem(olMailItem)
With olMail
olmail.To = Item.To
olmail.CC = Item.CC
olmail.Subject = Item.Subject
olmail.body = Item.Body
olmail.Send
End With

Set objInsp = Item.GetInspector
objInsp.Close 1
End Function



  #4  
Old August 9th 06, 11:44 PM posted to microsoft.public.outlook.program_forms
djohnson
external usenet poster
 
Posts: 6
Default Best way to get data from Item before send?


Sue wrote:
Instead of using To, you should call Item.Recipients.ResolveAll on the
original item, and if that returns True, iterate the Item.Recipients
collection and create matchin recipients on the new outgoing item.



I did that; thanks for the advice.


Never use CreateObject to create a new Outlook.Application object in your
custom form code. Use the intrinsic Application object that is already
available to you.


Would the intrinsic Application object be the Form Item? Maybe I
misunderstand. It was my understanding that this would send the whole
form including the code and end up creating a pane warning on the
recipients' end, which I was trying to avoid (not sure who would want
that). Since I only need code on the sender's end I don't want to send
the whole form.

  #5  
Old August 10th 06, 03:46 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Best way to get data from Item before send?

In any open form you have 2 intrinsic objects you never have to declare or
instantiate: Item (the form) and Application (the Outlook.Application
object). So you don't use CreateObject to get a handle to
Outlook.Application, you use the intrinsic Application object of the form.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"djohnson" wrote in message
ups.com...

Sue wrote:
Instead of using To, you should call Item.Recipients.ResolveAll on the
original item, and if that returns True, iterate the Item.Recipients
collection and create matchin recipients on the new outgoing item.



I did that; thanks for the advice.


Never use CreateObject to create a new Outlook.Application object in your
custom form code. Use the intrinsic Application object that is already
available to you.


Would the intrinsic Application object be the Form Item? Maybe I
misunderstand. It was my understanding that this would send the whole
form including the code and end up creating a pane warning on the
recipients' end, which I was trying to avoid (not sure who would want
that). Since I only need code on the sender's end I don't want to send
the whole form.


 




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
Edit MailEnvelope.Item Before .Send Jeff C Outlook and VBA 11 June 21st 06 04:06 PM
How can I create a outlook appointment item from data in a e-mail? StoltHD Outlook and VBA 6 June 17th 06 09:00 AM
How can I create a outlook appointment item from data in a e-mail? Eric Legault [MVP - Outlook] Outlook and VBA 0 June 15th 06 07:23 PM
Send.item ? mrrcomp Outlook and VBA 2 February 2nd 06 04:38 PM
A program is trying to send mail using Item.Send Vitesh Outlook and VBA 1 January 23rd 06 03:25 PM


All times are GMT +1. The time now is 08:43 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.