Form only works when running from Form Design

P

peddie

Hi,

Anyone could please help with my code.
I customised an outlook form with following code. The outlook client
could see the data when viewed with outlook internally. A lot of our
users use Blackberry. So I wrote this code so that it also sends a
plain text version of the email so Blackberry users could see it.

The codes only work if I open the form in design mode and choose 'Run
this form'. Once saved and come back to use the form, the following
codes do not seem to be generated. Any suggestions please?

Function Item_Send()

Dim strMessageType
Dim strTimeOfCall
Dim strCompanyName
Dim strContactName
Dim strContactNumber
Dim strDetail

set strMessageType = Item.UserProperties.Find("Message Type")
set strTimeOfCall = Item.UserProperties.Find("Time of call")
set strCompanyName = Item.UserProperties.Find("CustomerBusinessName")
set strContactName = Item.UserProperties.Find("Contact Name")
set strContactNumber = Item.UserProperties.Find("Contact Number")
set strDetail = Item.UserProperties.Find("Detail")

Item.Body = "Time of call: " & Left(strTimeOfCall,5) & vbCrLf & vbCrLf
& _
"Contact Name: " & strContactName & vbCrLf & vbCrLf & _
"Contact Number: " & strContactNumber & vbCrLf & vbCrLf & _
"Company Name: " & strCompanyName & vbCrLf & vbCrLf & _
"Detail: " & strDetail

Item.Save

End Function
 
S

Sue Mosher [MVP-Outlook]

Code doesn't run on unpublished or one-off forms. Based on your symptoms,
therefore, I'd say you have one or the other. Where did you publish the form
and what is the state of the "send form definition with item" box on the
(Proeprties) page in design mode?
 
P

peddie

Hi Sue,
I've been messing around with this form for awhile. At first, I decided
a form to be published on public folder however there are a lot of
problems with it i.e. when received, printing the form does not include
the customised fields. This only occured with customised form that is
published on the public folder.

So my second choice is to have this form designed as a outlook template
(.oft file). Majority of people can use this OK but Blackberry users
will see only built in fields but not customised fields.

When I saved the form, I chose no the save definitions to items, but
since I re-save the template, the question does not pop up anymore.

Does this make sense? Sorry i am very new to this.
Please advice

Thanks a million

Peddie
 
S

Sue Mosher [MVP-Outlook]

"received"? So this is a custom message form? For message forms with code to
work properly, they must be published either to the Organizational Forms
library or to each individual's Personal Forms library. An item created from
an .oft file will not run code.

Also note: The newsgroup interface you are using apparently does not quote
earlier messages in the thread, making your latest message so short on
detail that you risk not getting the answer you're looking for. Please take
the time to quote the original message.
 

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