Solved

Outlook and Visual Basic

Posted on 2003-11-12
6
940 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 is an explanation of a simple data model to help parse a JSON feed
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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

828 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