Outlook 2003 Custom Form Error Handling

  • Thread starter TWF1aTgw
  • Start date Views 2,544
Status
Not open for further replies.
T

TWF1aTgw

I would like to include some error handling in my VBScript on my custom form.

I've tried the On Error GoTo statement, but I keep getting a Syntax Error.

Then I've tried

On Error Resume Next

> ... code to check ...

If Err <> 0 Then

> ... do stuff

End If

But my error catching code does not seem to execute (I'm pretty sure my code

to check has a runtime error in it)

Basically, I have the following procedure call in one of my events:

Item.GetInspector ...

I know that it fails sometimes. I'd like to catch the error if my statement

fails and handle it.

Any suggestions?

Thanks in advance!
 
S

Sue Mosher [MVP]

VBScript does not support On Error GoTo. What you're doing with On Error

Resume Next and Err <> 0 is a good approach.

Item.GetInspector should never fail in a custom form. But if you're worried

that it might, this is the way to handle it:

On Error Resume Next

Set insp = Item.GetInspector

If insp Is Nothing Then

' there is no Inspector

Else

' do something with insp

End If

Sue Mosher

"Maui80" <Maui80> wrote in message

news:F846532B-BD9C-4169-9EC3-68B7A349C41C@microsoft.com...
> I would like to include some error handling in my VBScript on my custom
> form.
> I've tried the On Error GoTo statement, but I keep getting a Syntax Error.
> Then I've tried
> On Error Resume Next
> ... code to check ...
> If Err <> 0 Then
> ... do stuff
> End If
> But my error catching code does not seem to execute (I'm pretty sure my
> code
> to check has a runtime error in it)

> Basically, I have the following procedure call in one of my events:
> Item.GetInspector ...
> I know that it fails sometimes. I'd like to catch the error if my
> statement
> fails and handle it.

> Any suggestions?
> Thanks in advance!
 
T

TWF1aTgw

Thank you so much for your quick reply. Your answer was helpful in helping me

find that I might be on the wrong track in finding the source of my problem.

the Item.GetInspector line is in my custom appointment form. When I allow

scripts to run on shared calendars and then I use my custom form to book a

resource, the resource that autoaccepts my invitiation shows a blank body of

the message. (This doesn't happen when 'allow scripts to run on shared

calendars' is disabled.)

When I remove that Item.GetInspector line, I'm finding that the body of my

appointment message is there fine.

That's why I thought perhaps the form class changes to something else in the

resource calendar response and GetInspector object would not exist...

I've been trying to figure this out on an off for weeks now - Do you have

any ideas?

thanks again for your last response!

"Sue Mosher [MVP]" wrote:


> VBScript does not support On Error GoTo. What you're doing with On Error
> Resume Next and Err <> 0 is a good approach.

> Item.GetInspector should never fail in a custom form. But if you're worried
> that it might, this is the way to handle it:

> On Error Resume Next
> Set insp = Item.GetInspector
> If insp Is Nothing Then
> ' there is no Inspector
> Else
> ' do something with insp
> End If

> > Sue Mosher
> > >

> "Maui80" <Maui80> wrote in message
> news:F846532B-BD9C-4169-9EC3-68B7A349C41C@microsoft.com...
> >I would like to include some error handling in my VBScript on my custom
> >form.
> > I've tried the On Error GoTo statement, but I keep getting a Syntax Error.
> > Then I've tried
> > On Error Resume Next
> > ... code to check ...
> > If Err <> 0 Then
> > ... do stuff
> > End If
> > But my error catching code does not seem to execute (I'm pretty sure my
> > code
> > to check has a runtime error in it)
> > Basically, I have the following procedure call in one of my events:
> > Item.GetInspector ...
> > I know that it fails sometimes. I'd like to catch the error if my
> > statement
> > fails and handle it.
> > Any suggestions?
> > Thanks in advance!


>
 
T

TWF1aTgw

Also, I marked your answer as 'Yes' it helped because it was the right

response to my question. However, I'm still hoping someone will help me with

my bigger problem. Should I repost as a new question? Thanks!

"Sue Mosher [MVP]" wrote:


> VBScript does not support On Error GoTo. What you're doing with On Error
> Resume Next and Err <> 0 is a good approach.

> Item.GetInspector should never fail in a custom form. But if you're worried
> that it might, this is the way to handle it:

> On Error Resume Next
> Set insp = Item.GetInspector
> If insp Is Nothing Then
> ' there is no Inspector
> Else
> ' do something with insp
> End If

> > Sue Mosher
> > >

> "Maui80" <Maui80> wrote in message
> news:F846532B-BD9C-4169-9EC3-68B7A349C41C@microsoft.com...
> >I would like to include some error handling in my VBScript on my custom
> >form.
> > I've tried the On Error GoTo statement, but I keep getting a Syntax Error.
> > Then I've tried
> > On Error Resume Next
> > ... code to check ...
> > If Err <> 0 Then
> > ... do stuff
> > End If
> > But my error catching code does not seem to execute (I'm pretty sure my
> > code
> > to check has a runtime error in it)
> > Basically, I have the following procedure call in one of my events:
> > Item.GetInspector ...
> > I know that it fails sometimes. I'd like to catch the error if my
> > statement
> > fails and handle it.
> > Any suggestions?
> > Thanks in advance!


>
 
T

TWF1aTgw

Oh and I forgot to add, my Item.GetInspector is in the event

Sub Item_CustomPropertyChange(ByVal Name)

"Maui80" wrote:


> Thank you so much for your quick reply. Your answer was helpful in helping me
> find that I might be on the wrong track in finding the source of my problem.

> the Item.GetInspector line is in my custom appointment form. When I allow
> scripts to run on shared calendars and then I use my custom form to book a
> resource, the resource that autoaccepts my invitiation shows a blank body of
> the message. (This doesn't happen when 'allow scripts to run on shared
> calendars' is disabled.)

> When I remove that Item.GetInspector line, I'm finding that the body of my
> appointment message is there fine.

> That's why I thought perhaps the form class changes to something else in the
> resource calendar response and GetInspector object would not exist...

> I've been trying to figure this out on an off for weeks now - Do you have
> any ideas?

> thanks again for your last response!

> "Sue Mosher [MVP]" wrote:
>
> > VBScript does not support On Error GoTo. What you're doing with On Error
> > Resume Next and Err <> 0 is a good approach.
> > Item.GetInspector should never fail in a custom form. But if you're worried
> > that it might, this is the way to handle it:
> > On Error Resume Next
> > Set insp = Item.GetInspector
> > If insp Is Nothing Then
> > ' there is no Inspector
> > Else
> > ' do something with insp
> > End If
> > > > Sue Mosher
> > > > > > > > "Maui80" <Maui80> wrote in message
> > news:F846532B-BD9C-4169-9EC3-68B7A349C41C@microsoft.com...
> > >I would like to include some error handling in my VBScript on my custom
> > >form.
> > > I've tried the On Error GoTo statement, but I keep getting a Syntax Error.
> > > Then I've tried
> > > On Error Resume Next
> > > ... code to check ...
> > > If Err <> 0 Then
> > > ... do stuff
> > > End If
> > > But my error catching code does not seem to execute (I'm pretty sure my
> > > code
> > > to check has a runtime error in it)
> > > > Basically, I have the following procedure call in one of my events:
> > > Item.GetInspector ...
> > > I know that it fails sometimes. I'd like to catch the error if my
> > > statement
> > > fails and handle it.
> > > > Any suggestions?
> > > Thanks in advance!

> >
 
S

Sue Mosher [MVP]

What are you seeking to do with the Inspector? What exactly do you mean by

"shows a blank body"? In code? In the UI?

Sue Mosher

"Maui80" <Maui80> wrote in message

news:D13C5351-8319-4EB2-B0C1-7A1E49555827@microsoft.com...
> Thank you so much for your quick reply. Your answer was helpful in helping
> me
> find that I might be on the wrong track in finding the source of my
> problem.

> the Item.GetInspector line is in my custom appointment form. When I allow
> scripts to run on shared calendars and then I use my custom form to book a
> resource, the resource that autoaccepts my invitiation shows a blank body
> of
> the message. (This doesn't happen when 'allow scripts to run on shared
> calendars' is disabled.)

> When I remove that Item.GetInspector line, I'm finding that the body of my
> appointment message is there fine.

> That's why I thought perhaps the form class changes to something else in
> the
> resource calendar response and GetInspector object would not exist...

> I've been trying to figure this out on an off for weeks now - Do you have
> any ideas?

> thanks again for your last response!

> "Sue Mosher [MVP]" wrote:
>
> > VBScript does not support On Error GoTo. What you're doing with On Error
> > Resume Next and Err <> 0 is a good approach.
>

>> Item.GetInspector should never fail in a custom form. But if you're
> > worried
> > that it might, this is the way to handle it:
>

>> On Error Resume Next
> > Set insp = Item.GetInspector
> > If insp Is Nothing Then
> > ' there is no Inspector
> > Else
> > ' do something with insp
> > End If
>

>> "Maui80" <Maui80> wrote in message
> > news:F846532B-BD9C-4169-9EC3-68B7A349C41C@microsoft.com...
> > >I would like to include some error handling in my VBScript on my custom
> > >form.
> > > I've tried the On Error GoTo statement, but I keep getting a Syntax
> > > Error.
> > > Then I've tried
> > > On Error Resume Next
> > > ... code to check ...
> > > If Err <> 0 Then
> > > ... do stuff
> > > End If
> > > But my error catching code does not seem to execute (I'm pretty sure my
> > > code
> > > to check has a runtime error in it)
> >> > Basically, I have the following procedure call in one of my events:
> > > Item.GetInspector ...
> > > I know that it fails sometimes. I'd like to catch the error if my
> > > statement
> > > fails and handle it.
> >> > Any suggestions?
> > > Thanks in advance!

>

>
>>
 
T

TWF1aTgw

I have a custom tab on my appointment form. In it, I have a check box that

when the user checks or unchecks, it shows/hides a frame.

Sub Item_CustomPropertyChange(ByVal Name)

Select Case Name

Case "IsTrue"

Set oPage = Item.GetInspector.ModifiedFormPages

Set oCntrl = oPage("My Tab Name").Controls("My Control")

oCntrl.Visible = Item.UserProperties.Find("IsTrue").Value

Case "Etc"

> ...

End Select

End Sub

And when I mean 'blank body', I'm referring to the UI. In other words, the

message of the body is no longer there. I see the message body fine in my

calendar, but when I look at the calendar event in the resource calendar,

there is no message body.

In another post I made, the MVP suggested that when a user reply's, another

message class is used - IPM.Schedule.Meeting.Resp, and I would have to run

code to capture that item. So I tried checking if the

Item.MessageClass <> "IPM.Appointment.MyAppointment"

but that didn't help either...

"Sue Mosher [MVP]" wrote:


> What are you seeking to do with the Inspector? What exactly do you mean by
> "shows a blank body"? In code? In the UI?

> > Sue Mosher
> > >

> "Maui80" <Maui80> wrote in message
> news:D13C5351-8319-4EB2-B0C1-7A1E49555827@microsoft.com...
> > Thank you so much for your quick reply. Your answer was helpful in helping
> > me
> > find that I might be on the wrong track in finding the source of my
> > problem.
> > the Item.GetInspector line is in my custom appointment form. When I allow
> > scripts to run on shared calendars and then I use my custom form to book a
> > resource, the resource that autoaccepts my invitiation shows a blank body
> > of
> > the message. (This doesn't happen when 'allow scripts to run on shared
> > calendars' is disabled.)
> > When I remove that Item.GetInspector line, I'm finding that the body of my
> > appointment message is there fine.
> > That's why I thought perhaps the form class changes to something else in
> > the
> > resource calendar response and GetInspector object would not exist...
> > I've been trying to figure this out on an off for weeks now - Do you have
> > any ideas?
> > thanks again for your last response!
> > "Sue Mosher [MVP]" wrote:
> >
> >> VBScript does not support On Error GoTo. What you're doing with On Error
> >> Resume Next and Err <> 0 is a good approach.
> >
> >> Item.GetInspector should never fail in a custom form. But if you're
> >> worried
> >> that it might, this is the way to handle it:
> >
> >> On Error Resume Next
> >> Set insp = Item.GetInspector
> >> If insp Is Nothing Then
> >> ' there is no Inspector
> >> Else
> >> ' do something with insp
> >> End If
> >
> >> "Maui80" <Maui80> wrote in message
> >> news:F846532B-BD9C-4169-9EC3-68B7A349C41C@microsoft.com...
> >> >I would like to include some error handling in my VBScript on my custom
> >> >form.
> >> > I've tried the On Error GoTo statement, but I keep getting a Syntax
> >> > Error.
> >> > Then I've tried
> >> > On Error Resume Next
> >> > ... code to check ...
> >> > If Err <> 0 Then
> >> > ... do stuff
> >> > End If
> >> > But my error catching code does not seem to execute (I'm pretty sure my
> >> > code
> >> > to check has a runtime error in it)
> >> >> > Basically, I have the following procedure call in one of my events:
> >> > Item.GetInspector ...
> >> > I know that it fails sometimes. I'd like to catch the error if my
> >> > statement
> >> > fails and handle it.
> >> >> > Any suggestions?
> >> > Thanks in advance!
> >
> >
> >>


>
 
S

Sue Mosher [MVP]

I'm still not clear on what you're doing. Is the user working with a check

box on an appointment in the Calendar folder or on a meeting request in the

Inbox?

I can't think of any reason why GetInspector would affect the item body. Is

there any code behind the form that touches the Body property?

Also, you said you have a resource calendar that autoaccepts invitations. If

this an autoaccept script, have you looked at its code? If it's Exchange

2007, is the resource calendar configured not to store appointment details?

(That's an option in 2007.)

Sue Mosher

"Maui80" <Maui80> wrote in message

news:0A6194FF-01B4-4CD6-9799-71FE7EE564C1@microsoft.com...
> I have a custom tab on my appointment form. In it, I have a check box that
> when the user checks or unchecks, it shows/hides a frame.

> Sub Item_CustomPropertyChange(ByVal Name)
> Select Case Name
> Case "IsTrue"
> Set oPage = Item.GetInspector.ModifiedFormPages
> Set oCntrl = oPage("My Tab Name").Controls("My Control")
> oCntrl.Visible = Item.UserProperties.Find("IsTrue").Value
> Case "Etc"
> ...
> End Select
> End Sub

> And when I mean 'blank body', I'm referring to the UI. In other words, the
> message of the body is no longer there. I see the message body fine in my
> calendar, but when I look at the calendar event in the resource calendar,
> there is no message body.

> In another post I made, the MVP suggested that when a user reply's,
> another
> message class is used - IPM.Schedule.Meeting.Resp, and I would have to
> run
> code to capture that item. So I tried checking if the

> Item.MessageClass <> "IPM.Appointment.MyAppointment"

> but that didn't help either...

> "Sue Mosher [MVP]" wrote:
>
> > What are you seeking to do with the Inspector? What exactly do you mean
> > by
> > "shows a blank body"? In code? In the UI?
>

>
>> "Maui80" <Maui80> wrote in message
> > news:D13C5351-8319-4EB2-B0C1-7A1E49555827@microsoft.com...
> > > Thank you so much for your quick reply. Your answer was helpful in
> > > helping
> > > me
> > > find that I might be on the wrong track in finding the source of my
> > > problem.
> >> > the Item.GetInspector line is in my custom appointment form. When I
> > > allow
> > > scripts to run on shared calendars and then I use my custom form to
> > > book a
> > > resource, the resource that autoaccepts my invitiation shows a blank
> > > body
> > > of
> > > the message. (This doesn't happen when 'allow scripts to run on shared
> > > calendars' is disabled.)
> >> > When I remove that Item.GetInspector line, I'm finding that the body of
> > > my
> > > appointment message is there fine.
> >> > That's why I thought perhaps the form class changes to something else
> > > in
> > > the
> > > resource calendar response and GetInspector object would not exist...
> >> > I've been trying to figure this out on an off for weeks now - Do you
> > > have
> > > any ideas?
> >> > thanks again for your last response!
> >> > "Sue Mosher [MVP]" wrote:
> >> >> VBScript does not support On Error GoTo. What you're doing with On
> > >> Error
> > >> Resume Next and Err <> 0 is a good approach.
> > >
>> >> Item.GetInspector should never fail in a custom form. But if you're
> > >> worried
> > >> that it might, this is the way to handle it:
> > >
>> >> On Error Resume Next
> > >> Set insp = Item.GetInspector
> > >> If insp Is Nothing Then
> > >> ' there is no Inspector
> > >> Else
> > >> ' do something with insp
> > >> End If
> > >
>> >> "Maui80" <Maui80> wrote in message
> > >> news:F846532B-BD9C-4169-9EC3-68B7A349C41C@microsoft.com...
> > >> >I would like to include some error handling in my VBScript on my
> > >> >custom
> > >> >form.
> > >> > I've tried the On Error GoTo statement, but I keep getting a Syntax
> > >> > Error.
> > >> > Then I've tried
> > >> > On Error Resume Next
> > >> > ... code to check ...
> > >> > If Err <> 0 Then
> > >> > ... do stuff
> > >> > End If
> > >> > But my error catching code does not seem to execute (I'm pretty sure
> > >> > my
> > >> > code
> > >> > to check has a runtime error in it)
> > >>> >> > Basically, I have the following procedure call in one of my events:
> > >> > Item.GetInspector ...
> > >> > I know that it fails sometimes. I'd like to catch the error if my
> > >> > statement
> > >> > fails and handle it.
 
T

TWF1aTgw

My custom form is a custom appointment form, so they are working with

appointments off the Calendar.

Yes, I am adding stuff to the Body property. To test, I decided to remove

all my code (so that it still works) that alters Item.Body. The behavior is

still the same - the message body is gone. Only when I remove that

Item.GetInspector code when the body of the message stays intact.

And yes, the resource calendar is set to autoaccept - but this is not using

a custom script. We're using Outlook 2003 on Exchange 2003 and are not even

using auto-accept agent. The way we set up our resource calendar was from

Tools > Options > Preferences (Tab) > Calendar Options (Button) > Resource

Scheduling (Button) > Automatically accept meeting requests... (option

checked). No extra bells and/or whistles. Perhaps Outlook 2003 has some

scripts running for that I don't know about?

It is still very strange that this behavior happens only when 'Allow Scripts

to Run on Shared Calendars' is checked.

Thanks for your patience.

"Sue Mosher [MVP]" wrote:


> I'm still not clear on what you're doing. Is the user working with a check
> box on an appointment in the Calendar folder or on a meeting request in the
> Inbox?

> I can't think of any reason why GetInspector would affect the item body. Is
> there any code behind the form that touches the Body property?

> Also, you said you have a resource calendar that autoaccepts invitations. If
> this an autoaccept script, have you looked at its code? If it's Exchange
> 2007, is the resource calendar configured not to store appointment details?
> (That's an option in 2007.)

> > Sue Mosher
> > >

> "Maui80" <Maui80> wrote in message
> news:0A6194FF-01B4-4CD6-9799-71FE7EE564C1@microsoft.com...
> >I have a custom tab on my appointment form. In it, I have a check box that
> > when the user checks or unchecks, it shows/hides a frame.
> > Sub Item_CustomPropertyChange(ByVal Name)
> > Select Case Name
> > Case "IsTrue"
> > Set oPage = Item.GetInspector.ModifiedFormPages
> > Set oCntrl = oPage("My Tab Name").Controls("My Control")
> > oCntrl.Visible = Item.UserProperties.Find("IsTrue").Value
> > Case "Etc"
> > ...
> > End Select
> > End Sub
> > And when I mean 'blank body', I'm referring to the UI. In other words, the
> > message of the body is no longer there. I see the message body fine in my
> > calendar, but when I look at the calendar event in the resource calendar,
> > there is no message body.
> > In another post I made, the MVP suggested that when a user reply's,
> > another
> > message class is used - IPM.Schedule.Meeting.Resp, and I would have to
> > run
> > code to capture that item. So I tried checking if the
> > Item.MessageClass <> "IPM.Appointment.MyAppointment"
> > but that didn't help either...
> > "Sue Mosher [MVP]" wrote:
> >
> >> What are you seeking to do with the Inspector? What exactly do you mean
> >> by
> >> "shows a blank body"? In code? In the UI?
> >
> >
> >> "Maui80" <Maui80> wrote in message
> >> news:D13C5351-8319-4EB2-B0C1-7A1E49555827@microsoft.com...
> >> > Thank you so much for your quick reply. Your answer was helpful in
> >> > helping
> >> > me
> >> > find that I might be on the wrong track in finding the source of my
> >> > problem.
> >> >> > the Item.GetInspector line is in my custom appointment form. When I
> >> > allow
> >> > scripts to run on shared calendars and then I use my custom form to
> >> > book a
> >> > resource, the resource that autoaccepts my invitiation shows a blank
> >> > body
> >> > of
> >> > the message. (This doesn't happen when 'allow scripts to run on shared
> >> > calendars' is disabled.)
> >> >> > When I remove that Item.GetInspector line, I'm finding that the body of
> >> > my
> >> > appointment message is there fine.
> >> >> > That's why I thought perhaps the form class changes to something else
> >> > in
> >> > the
> >> > resource calendar response and GetInspector object would not exist...
> >> >> > I've been trying to figure this out on an off for weeks now - Do you
> >> > have
> >> > any ideas?
> >> >> > thanks again for your last response!
> >> >> > "Sue Mosher [MVP]" wrote:
> >> >> >> VBScript does not support On Error GoTo. What you're doing with On
> >> >> Error
> >> >> Resume Next and Err <> 0 is a good approach.
> >> >
> >> >> Item.GetInspector should never fail in a custom form. But if you're
> >> >> worried
> >> >> that it might, this is the way to handle it:
> >> >
> >> >> On Error Resume Next
> >> >> Set insp = Item.GetInspector
> >> >> If insp Is Nothing Then
> >> >> ' there is no Inspector
> >> >> Else
> >> >> ' do something with insp
> >> >> End If
> >> >
> >> >> "Maui80" <Maui80> wrote in message
> >> >> news:F846532B-BD9C-4169-9EC3-68B7A349C41C@microsoft.com...
> >> >> >I would like to include some error handling in my VBScript on my
> >> >> >custom
> >> >> >form.
> >> >> > I've tried the On Error GoTo statement, but I keep getting a Syntax
> >> >> > Error.
> >> >> > Then I've tried
> >> >> > On Error Resume Next
> >> >> > ... code to check ...
> >> >> > If Err <> 0 Then
> >> >> > ... do stuff
> >> >> > End If
> >> >> > But my error catching code does not seem to execute (I'm pretty sure
> >> >> > my
> >> >> > code
> >> >> > to check has a runtime error in it)
> >> >> >> >> > Basically, I have the following procedure call in one of my events:
> >> >> > Item.GetInspector ...
> >> >> > I know that it fails sometimes. I'd like to catch the error if my
> >> >> > statement
> >> >> > fails and handle it.


>
 
Status
Not open for further replies.
Top