Solved

Outlook and Visual Basic

Posted on 2003-11-12
6
942 Views
Last Modified: 2013-12-04
I have build a custom form in outlook 2000 which has 2 labels. Now i am calling this function from a visual basic project which is sending this form as mail.This is what i am writing in the vb project. This vb project i am creating in Visual Basic 6.0.
general Declaration
Dim objoutlookapp As New Outlook.Application
Dim objoutlookmail As Outlook.MailItem
Dim objins As Outlook.Inspector
Dim objModifiedForm

on button click:
Set objoutlookapp = New Outlook.Application
Set objoutlookmail = objoutlookapp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.Add("IPM.Note.HEP_RESPONSE")
Set objModifiedForm = objoutlookmail.GetInspector.ModifiedFormPages("Response")
objModifiedForm.Controls("lblRsNoVal").Caption = "23445"
objModifiedForm.Controls("lblCustNo").Caption = "1234"
objoutlookmail.To = "fdfdf"

objoutlookmail.Display
and then the user clicks send.
Now the problem is that before sending the mail all the label values is coming but on receiver end these values are not coming.  I have already attached these values by creating the "user fields" in the custom form but still it is not getting saved.

any idea where i am wrong!!!
0
Comment
Question by:pg_india
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9738964
is the reciever getting the custom form or a normal form?
0
 
LVL 3

Author Comment

by:pg_india
ID: 9739040
the custom form, but the value in the fields is not coming.
Has some one tried it out before!!!!!!!!!!
0
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9745181
I have not done it thro a macro but will revert back
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:pg_india
ID: 9745520
i am not using the macro. i have created a vb program which is opening the outlook object and doing the above steps.

Kindly tell me how to do this!!!
I don't have much points so increasing the points by 20.
0
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9745599
pg dont worry on points. this is not the only reason i answer questions

is the custom form showing the fields? when i created a custom form
objoutlookmail.GetInspector.ModifiedFormPages("Response") returned nothing. can you explaing the custom form setting? one more thing can you email me the custom form ro bhagyesht "at" fastmail.fm?
from the code the following can be concluded
you are setting the caption's value
just in case you are not aware in a custom form you have 2 pages one for the editing or composing and the other is for the user to read. you should be able to see both this pages from the form menu and select edit read page. its the read page that the user sees. try to set values to this page.
or tell me what are your custom form's settings
0
 
LVL 9

Accepted Solution

by:
bhagyesht earned 70 total points
ID: 9745884
ok pg I was able to send a message with user defined fields and the following is how you should be able to do the same.
first i designed a form and published it under the name as HEP_RESPONSE
then in the "All fields" tab under the drop down of "select from" select HEP_RESPONSE
add a property named as bt1
publish the form
now make active the message tab
goto the form menu and select "Edit Read page"
add a label
right click on the label and goto properties
goto the value tab and select the field bt1
publish the form

now the following code runs fine



'code begins
Dim objoutlookapp As New Outlook.Application
Dim objoutlookmail As Outlook.MailItem
Dim objins As Outlook.Inspector
Dim objModifiedForm

Set objoutlookapp = New Outlook.Application
Set objoutlookmail = objoutlookapp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.Add("IPM.Note.HEP_RESPONSE")

objoutlookmail.UserProperties("bt1").Value = "1234"
objoutlookmail.To = "test@testme.com"

objoutlookmail.Display
'code ends
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question