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

Emailing a Post form



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 16th 06, 03:40 PM posted to microsoft.public.outlook.program_vba
robert
external usenet poster
 
Posts: 127
Default Emailing a Post form

I have created a custom form using the Post form. On the form, users will
select a recipient. I want that recipient to receive an email when the form
is posted. I have the following code. How do I get it to email the selected
recipient? I don't want to hard-code an email address in the code because
the recipient will vary.

Function Item_Write()
Set newItem = Application.CreateItem(0)
With newItem
..To = ???
..Subject = "New On-Site Visit Report"
..Body = "There is a new On-Site Visit Report for you to view."
..Send
End With
End Function

  #2  
Old October 16th 06, 05:09 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Emailing a Post form

Did you want to present the user with the Address Book dialog to select a
Recipient? If so, you can't do this with the Outlook Object Model. You'll
have to use CDO - see the Session.AddressBook method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Robert" wrote:

I have created a custom form using the Post form. On the form, users will
select a recipient. I want that recipient to receive an email when the form
is posted. I have the following code. How do I get it to email the selected
recipient? I don't want to hard-code an email address in the code because
the recipient will vary.

Function Item_Write()
Set newItem = Application.CreateItem(0)
With newItem
.To = ???
.Subject = "New On-Site Visit Report"
.Body = "There is a new On-Site Visit Report for you to view."
.Send
End With
End Function

  #3  
Old October 16th 06, 05:36 PM posted to microsoft.public.outlook.program_vba
robert
external usenet poster
 
Posts: 127
Default Emailing a Post form

There's only 2 or 3 choices to choose from so it doesn't need to be the
address book. It could be a Combo Box.

I've tried the following but I get "Object Required" when I post the form.

..To = ComboBox1.text

"Eric Legault [MVP - Outlook]" wrote:

Did you want to present the user with the Address Book dialog to select a
Recipient? If so, you can't do this with the Outlook Object Model. You'll
have to use CDO - see the Session.AddressBook method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Robert" wrote:

I have created a custom form using the Post form. On the form, users will
select a recipient. I want that recipient to receive an email when the form
is posted. I have the following code. How do I get it to email the selected
recipient? I don't want to hard-code an email address in the code because
the recipient will vary.

Function Item_Write()
Set newItem = Application.CreateItem(0)
With newItem
.To = ???
.Subject = "New On-Site Visit Report"
.Body = "There is a new On-Site Visit Report for you to view."
.Send
End With
End Function

  #4  
Old November 1st 06, 08:14 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Emailing a Post form

See http://www.outlookcode.com/d/propsyntax.htm for the correct syntax for referring to controls.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Robert" wrote in message ...
There's only 2 or 3 choices to choose from so it doesn't need to be the
address book. It could be a Combo Box.

I've tried the following but I get "Object Required" when I post the form.

.To = ComboBox1.text

"Eric Legault [MVP - Outlook]" wrote:

Did you want to present the user with the Address Book dialog to select a
Recipient? If so, you can't do this with the Outlook Object Model. You'll
have to use CDO - see the Session.AddressBook method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Robert" wrote:

I have created a custom form using the Post form. On the form, users will
select a recipient. I want that recipient to receive an email when the form
is posted. I have the following code. How do I get it to email the selected
recipient? I don't want to hard-code an email address in the code because
the recipient will vary.

Function Item_Write()
Set newItem = Application.CreateItem(0)
With newItem
.To = ???
.Subject = "New On-Site Visit Report"
.Body = "There is a new On-Site Visit Report for you to view."
.Send
End With
End Function

  #5  
Old November 1st 06, 08:33 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Emailing a Post form

If you need to refer to a control value or a custom property value in an
Outlook form, you have to use different syntax.

For a control value:

myVar = Item.GetInspector.ModifiedFormPages("P.1").Control s("ComboBox1").Value

For a custom field (if you bound your control to a field, use this approach
instead):

myVar = Item.UserProperties("MyFieldName").Value

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Robert" wrote:

There's only 2 or 3 choices to choose from so it doesn't need to be the
address book. It could be a Combo Box.

I've tried the following but I get "Object Required" when I post the form.

.To = ComboBox1.text

"Eric Legault [MVP - Outlook]" wrote:

Did you want to present the user with the Address Book dialog to select a
Recipient? If so, you can't do this with the Outlook Object Model. You'll
have to use CDO - see the Session.AddressBook method.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Robert" wrote:

I have created a custom form using the Post form. On the form, users will
select a recipient. I want that recipient to receive an email when the form
is posted. I have the following code. How do I get it to email the selected
recipient? I don't want to hard-code an email address in the code because
the recipient will vary.

Function Item_Write()
Set newItem = Application.CreateItem(0)
With newItem
.To = ???
.Subject = "New On-Site Visit Report"
.Body = "There is a new On-Site Visit Report for you to view."
.Send
End With
End Function

 




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
Emailing a custom form robert Outlook - Using Forms 1 November 30th 06 05:26 PM
Emailing Contacts made with custom form internally rikper Outlook - Using Contacts 1 August 11th 06 02:52 AM
RecipientControl in Post custom form Bill Outlook - Using Forms 1 May 11th 06 08:32 PM
How to keep Post Form anonymous when printing or saving? andreag Outlook - Using Forms 1 May 11th 06 06:29 PM
Auto Number in a Custom Post Form Chuck Rich Outlook - Using Forms 1 February 13th 06 07:28 PM


All times are GMT +1. The time now is 07:02 AM.


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.