Solved

Outlook and Visual Basic

Posted on 2003-11-12
6
936 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now