Re: making frames dissapear using checkboxes



Perfect, I don't know what was different but it worked, now to make this do
the same thing for the Item Open event handler, the code will appear as.....

Sub Item_Open_CustomPropertyChange(ByVal Name)
Select Case Name
Case "ITTicketVisible"
Set myinspector = Item.GetInspector
Set myPage1 = myInspector.ModifiedFormPages("Message")
Set frame4 = myPage1.Controls("Frame4")
Frame4.Visible = Item.UserProperties("ITTicketVisible")
End Select
End Sub

Is this correct?

"Sue Mosher [MVP-Outlook]" wrote:

Try deleting that statement and typing it back in. Also make sure you have only straight quotes in your code, not curly quotes.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"daphnejean77" <daphnejean77@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:C1121F65-1B76-429C-AA4E-29AC5E4A58B7@xxxxxxxxxxxxxxxx
Yes, this makes so much more sense. I am getting an error message though.
The form is telling me - invalid character line 2 - why is Select Case Name
invalid? Am I missing something else?

"Sue Mosher [MVP-Outlook]" wrote:

You're definitely headed in the right direction. I don't know if you see it laid out differently in your code window but indenting is your friend and can show you possible problem areas, so let's give your code some proper indenting to see what clues that might give us:

Sub Item_CustomPropertyChange(ByVal Name)
Select Case Name
Case “ITTicketVisible”
strFrame4 = Item.UserProperties(“ITTicketVisible”)
Select Case strITTicketVisible
If “ITTicketVisible” = ????WHAT????
Set myinspector = Item.GetInspector
Set myPage1 = myInspector.ModifiedFormPages("Message")
Set frame4 = myPage1.Controls("Frame4")
Set ITTicketVisible = myPage1.Controls("ITTicketVisible")
Frame4.Visible = ITTicketVisible.Value
End Select
End Sub

It should be obvious that you're missing an End Select for the second Select Case block and an End If for the If statement.

But there's more to it than that. The problems starts here, although this is a perfectly valid statement:

strFrame4 = Item.UserProperties(“ITTicketVisible”)

strFrame4 suggests that you want to get a string property, but you don't, do you? ITTicketVisible is a yes/no property, right? THen Item.UserProperties("ITTicketVisible") can return only one of two values, True or False. Hold that thought for now.

Here's the first real problem statement:

Select Case strITTicketVisible

You haven't set any value for strITTicketVisible. Did you mean to use that as the variable name instead of strFrame4?

And another problem statement:

If “ITTicketVisible” = ????WHAT????

"ITTicketVisible" is a string literal. It serves no purpose here at all. In fact, the second Select Case statement has no purpose either. Let's get rid of both of these statements.

This statement also is unnecessary:

Set ITTicketVisible = myPage1.Controls("ITTicketVisible")

Why? Because you already know the value of the control. It's Item.UserProperties("ITTicketVisible"), the value of the yes/no property bound to the check box.

So, let's throw out all the unnecessary statements and keep what's useful:

Sub Item_CustomPropertyChange(ByVal Name)
Select Case Name
Case "ITTicketVisible"
Set myinspector = Item.GetInspector
Set myPage1 = myInspector.ModifiedFormPages("Message")
Set frame4 = myPage1.Controls("Frame4")
Frame4.Visible = Item.UserProperties("ITTicketVisible")
End Select
End Sub

Does that make a little more sense?


"daphnejean77" <daphnejean77@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:4B1A0353-7075-46ED-A6D7-B55A6B4491A4@xxxxxxxxxxxxxxxx
So far I have the below code, it is giving me an error on line three and I am
not even sure I am headed in the right direction at this point.

Sub Item_CustomPropertyChange(ByVal Name)
Select Case Name
Case “ITTicketVisible”
strFrame4 = Item.UserProperties(“ITTicketVisible”)
Select Case strITTicketVisible
If “ITTicketVisible” = ????WHAT????
Set myinspector = Item.GetInspector
Set myPage1 = myInspector.ModifiedFormPages("Message")
Set frame4 = myPage1.Controls("Frame4")
Set ITTicketVisible = myPage1.Controls("ITTicketVisible")
Frame4.Visible = ITTicketVisible.Value
End Select
End Sub

"Sue Mosher [MVP-Outlook]" wrote:

Why don't you show us what you have and give us an idea of where you're stuck?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"daphnejean77" <daphnejean77@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:8FB13344-5C8D-496D-AF22-C6A0D0F2D751@xxxxxxxxxxxxxxxx
Ok, so I actually understood more than I thought I did. I have a checkbox
already created with the property to tie it to the frame. Now I am really
struggling with writing code for Custom Property Change and the Open event.
I don't have permission to publish them to the exchange server, but once the
forms are created they will be published by IT to the exchange server. For
the moment I publish them to my personal forms to make sure they work
properly.
I have been going over and over the link for writing CustomPropertyChange
code and it is where I seem to be getting stuck for some reason.

"Sue Mosher [MVP-Outlook]" wrote:

I am not understanding how to create a Yes/No Property that will store information about the frame.

Let's try breaking this down into two concepts. I think may help you put it together.

You know how to create a yes/no property, right? Just click the New button on the Field Chooser, choose the type of property and give it a name. You might call it FrameVisible to remind you of what the property means. (If you already have a property you're using, that's fine, too. We can go with that. I think it might be helpful, though, for you to think of even an existing yes/no property as the "FrameVisible" property.)

Now you have a place to store information about the state of the frame. So far so good? The next question is: How does the property become associated with the frame's visibility? In two ways -- the user needs a way to interact with the property, and the form needs code that use the property value to change the Visibility property of the frame. You can take care of the first with a check box. Drag the property from the Field Chooser to the form, and Outlook will create a check box automatically. For the second, you need to write code in two places -- the CustomPropertyChange event and the Open event. More on that in our next installment. For now, I just want to make sure you have the "big picture," with diagrammed out, looks something like this:

User > check box > property

Property > code > frame visibility

In other words, the user interacts with the check box to change the property value, and the code uses the property value to alter the frame's visibility.

With me so far?

BTW, you said this is a custom email form. Is it for internal use only? Do you have permission to publish forms to the Organizational Forms library on your Exchange Server?



.


Loading