Enterprise Fields

S

schemr

hi,
i wanted to know if it is possible to use the data entered into the
enterprise fields to say import into an email and send to someone. also, this
email address would be entered into the enterprise field. is there a way to
create a button in MS Project so that it is possible to pull data from the
enterprise Project fields and use them in an email. please help. also post
if the Q isnt clear.

schemr
 
E

Ed Morrison

schemr,
I am assuming that you are using Outlook. If not, set a reference to the
appropriate email client.
First set a reference to Microsoft Outlook 11 object library (or the
appropriate version).

The sample code is:
Dim myolApp As Outlook.Application
Dim myItem As Outlook.MailItem
Set myolApp = CreateObject("Outlook.Application")
Set myItem = myolApp.CreateItem(olMailItem)
myItem.To = "(e-mail address removed)"
myItem.Subject = ActiveProject.Name 'Project's name
myItem.Body = ActiveProject.Tasks(1).EnterpriseText1
myItem.Send
 
S

schemr

hi ed,
thanx for the quik response. im gettin the following error when i try out
the code:
"Compile Error:
User-defined type not defined"

i am using the EXACT code that i have typed here:
*****
Public Sub Email()
Dim myolApp As Outlook.Application
Dim myItem As Outlook.MailItem
Set myolApp = CreateObject("Outlook.Application")
Set myItem = myolApp.CreateItem(olMailItem)

myItem.To = "(e-mail address removed)"
myItem.Subject = ActiveProject.Name 'Project's name
myItem.Body = ActiveProject.Tasks(1).EnterpriseProjectText1
myItem.Send

End Sub
****

this is the only code in the project. also i have chekd to see if the
reference to MS Outlook exists. it does. the ref is to MS Outlook 11 and
since i use outlook 2003 this is correct. please help

schemr
 
S

schemr

again,
thank you. i just made a stupid mistake in readin the reference. sry about
that. also, this code does not open the compose new mail window. it just
opens a promt in MS Outlook that says that there is a program that is trying
to send a mail. it could be a virus. do u want to send or not. i want to know
how it would be possible to open the compose window and the
EnterpriseProjectText1 field is not going into the email. please help. thanx.

schemr
 
E

Ed Morrison

schemr,
Change the body line to myItem.Body = "test-" &
ActiveProject.Tasks(1).GetField(pjTaskEnterpriseDuration1). The other line
should work, but I know this one does. I changed it to duration because I
had a value in that field.

I'm not sure how to open the window so your user can edit it prior to
sending. Try posting a question in a Outlook related site. Or you could
create a form with the body in it. Then add that body to the email and
send.

--
Ed Morrison
msProjectExperts
"We wrote the books on Project Server"
http://www.msprojectexperts.com
FAQ - http://www.projectserverexperts.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top