What am I doing wrong!??

J

Jackson Smith

I am trying write a script that hides/unhides a page in an
email form when a checkbox is unchecked/checked. (Outlook
2000) I have little experience with programming VB script
so I am having trouble figuring out my problem. When I
run the script below I get the following error: "You
don't have appropriate permission to perform this
operation" I am not sure if I have a line of code wrong
or my form set up wrong. It works in a demo that I
downloaded but I can't get it to work in my form. Any
help would be GREATLY appreciated. I am new at this so
please try to dumb it down for me!


Sub Item_CustomPropertyChange(ByVal CheckBox15)
Dim objInsp

Set MyPage = Item.GetInspector.ModifiedFormPages("Memo
Request:")

If MyPage.Controls("CheckBox15").value = false then
Set objInsp = Item.GetInspector
objInsp.HideFormPage "Bill of Materials:"
Set objInsp = Nothing
Else
Set objInsp = Item.GetInspector
objInsp.ShowFormPage "Bill of Materials:"
Set objInsp = Nothing
End If

Any help would be greatly appreciated.
Thanks,
Jack
 
S

Sue Mosher [MVP-Outlook]

The first problem is the construction of your CustomPropertyChange event
handler. As you have it now, it runs your code every time any custom
property changes. I'm sure that's not what you want. The argument for that
event handler, regardless of what you call it in your procedure declaration,
is always the name of the property that changed. See
http://www.outlookcode.com/d/propsyntax.htm#custom for an example of a
properly constructed CustomPropertyChange event handler.

Also, you should be checking the value of the property to which the
CheckBox15 control is bound, not the value of the control.

Beyond that, I'd check the names of the pages for typos, expecially leading
or trailing spaces. If you continue to have problems, you may need to step
through the code with the script debugger to determine which statement
triggers the error.
 

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