Run Macro when user saves

F

Flemming

All,

I have a custom form and I would like to make sure that sertain fields al
filled in correctly when the user saves it, how do I do that??

Flemming
 
S

Sue Mosher [MVP-Outlook]

The easiest way is to use the Validation tab on the Properties dialog for the control for each field.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
F

Flemming

Hey Sue

Thank You for Your reply. But I was wondering if the validation would be
possible to do in VB scripting, since my validation is a bit more complex
than the validation tab allows.

And yes I put this question into another forum as well, since I was unsure
if I put this question into the right forum. I hope I did not do something
that is not allowed?

Kind regards
Flemming
 
S

Sue Mosher [MVP-Outlook]

Put code in the Item_Send event handler to check the property values (see http://www.outlookcode.com/d/propsyntax.htm). If they aren't what you want them to be, tell the user and set the return value of the function to False:

Function Item_Send()
If <values are right> Then
Item_Send = False
End If
End Function

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
F

Flemming

Hey Sue

Thank You, this was very helpfull!

But I still have a problem, why can I not change the "Label" field in a
standard Appointment form?

Flemming
 
S

Sue Mosher [MVP-Outlook]

Are you referring to the calendar color labels? I don't understand how that connects with your original question.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
F

Flemming

I am using the Appointment form as a the template for my personal form an the
field that I want to controle/verify on close of the form is the Label field!
Does that make any sence?

Kind regards
Flemming
 
S

Sue Mosher [MVP-Outlook]

So you are referring to the calendar color labels? They are not accessible with the Outlook object model, but can be accessed with CDO 1.21 or Redemption; see http://www.outlookcode.com/codedetail.aspx?id=139 for sample code. The catch is that you must save the item before you can pass it over to CDO or Redemption. Generally, it's not a good idea to save an item with code in the Item_Write event handler, but maybe it would work with something like this:

Dim IsCheckingLabel

Function Item_Write()
If IsCheckingLabel = False Then
IsCheckingLabel = True
Item.Save
Else
' perform validation on calendar label, passing saved item to CDO or Redemption
IsCheckingLabel = False
End If
End Function

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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