Solved

Outlook and Visual Basic

Posted on 2003-11-12
6
934 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
wordsWithout 49 80
My 2003 Land Rover discovery 2 key for code for car alarm 7 82
endX challenge 2 50
pairs challenge 5 45
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
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 …
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…

747 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

9 Experts available now in Live!

Get 1:1 Help Now