A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Form called by actions...



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 26th 07, 06:50 PM posted to microsoft.public.outlook.program_forms
curram
external usenet poster
 
Posts: 8
Default Form called by actions...

When an action is selected, I open a new form (specified on the Actions tab
as a reply, do not include original message.) The form has the following
code:

dim olns
Dim pgRequest

Function Item_Open()

msgbox "open form"
Set olns = Application.GetNameSpace("MAPI")
'Set the page
Set pgRequest = Item.GetInspector.ModifiedFormPages("Main")
msgbox "open"
End Function


Sub Item_CustomPropertyChange(ByVal Name)
on error goto 0
Set olns = Application.GetNameSpace("MAPI")
'Set the page
Set pgRequest = Item.GetInspector.ModifiedFormPages("Main")
msgbox "property"
....
End Sub

I receive the error message Object doesn't support this property or method:
'item.getinspector'" citing the line in the Item_CustomPropertyChange sub.
Then for each field on the form I get "You do not have appropriate
permissions to perform this operation". The "item_open" code never fires.

If I remove the Item_CustomPropertyChange sub code, the item_open code
executes without error.

Do you have ideas as to what is wrong?

Thanks
  #2  
Old September 26th 07, 09:35 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Form called by actions...

In general, CustomPropertyChange event handlers should use a Select block to monitor for changes in specific properties; see http://www.outlookcode.com/article.aspx?ID=38. The code you have in that event handler doesn't serve any obvious purpose, especially as it duplicates what is in Item_Open.

Also, you may want to use a module-level Boolean variable to track whether Outlook has opened the item. Set it to True after all other code has run in Item_Open and don't do your property change processing unless it is True.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"curram" wrote in message ...
When an action is selected, I open a new form (specified on the Actions tab
as a reply, do not include original message.) The form has the following
code:

dim olns
Dim pgRequest

Function Item_Open()

msgbox "open form"
Set olns = Application.GetNameSpace("MAPI")
'Set the page
Set pgRequest = Item.GetInspector.ModifiedFormPages("Main")
msgbox "open"
End Function


Sub Item_CustomPropertyChange(ByVal Name)
on error goto 0
Set olns = Application.GetNameSpace("MAPI")
'Set the page
Set pgRequest = Item.GetInspector.ModifiedFormPages("Main")
msgbox "property"
...
End Sub

I receive the error message Object doesn't support this property or method:
'item.getinspector'" citing the line in the Item_CustomPropertyChange sub.
Then for each field on the form I get "You do not have appropriate
permissions to perform this operation". The "item_open" code never fires.

If I remove the Item_CustomPropertyChange sub code, the item_open code
executes without error.

Do you have ideas as to what is wrong?

Thanks

  #3  
Old September 26th 07, 10:26 PM posted to microsoft.public.outlook.program_forms
Hollis Paul
external usenet poster
 
Posts: 242
Default Form called by actions...

In article ,
=?Utf-8?B?Y3VycmFt?= wrote:
dim olns
Dim pgRequest

Function Item_Open()

msgbox "open form"
Set olns = Application.GetNameSpace("MAPI")
'Set the page
Set pgRequest = Item.GetInspector.ModifiedFormPages("Main")
msgbox "open"
End Function


Sub Item_CustomPropertyChange(ByVal Name)
on error goto 0
Set olns = Application.GetNameSpace("MAPI")
'Set the page
Set pgRequest = Item.GetInspector.ModifiedFormPages("Main")
msgbox "property"
....
End Sub

I receive the error message Object doesn't support this property or method:
'item.getinspector'" citing the line in the Item_CustomPropertyChange sub.
Then for each field on the form I get "You do not have appropriate
permissions to perform this operation". The "item_open" code never fires.

If I remove the Item_CustomPropertyChange sub code, the item_open code
executes without error.

Do you have ideas as to what is wrong?

Thanks

Since pgRequest is dim'd globally, initialized in the Item_Open event, and not
set to nothing anywhere, it can be used as long as the Item is open. It
really constitutes the "module-level Boolean variable" that Sue speaks of.
So, everywhere you want to return to your main page, just do pgRequest.show
and the main page will appear. However, you should correct your
Item_CustomPropertyChange sub code to use the expected Case format code, so
that it just fires in the case of your custom property changing. Otherwise,
you will have the main page flashing up every time you complete a field.

--
Hollis Paul
Mukilteo, WA USA


  #4  
Old September 27th 07, 01:47 PM posted to microsoft.public.outlook.program_forms
curram
external usenet poster
 
Posts: 8
Default Form called by actions...

My Item_CustomPropertyChange block does have the case statement...just didn't
feel the need to include it since my issue seems to be setting the page
request.

When I have the Item_CustomPropertyChange sub in my code the item_open
apparently does not execute since I do not get the open message, but when the
Item_CustomPropertyChange sub is deleted from the script the item_open code
executes.

I will see what happens without setting pgRequest in the
Item_CustomPropertyChange block

Thank you for your responses...any other ideas?
"Hollis Paul" wrote:

In article ,
=?Utf-8?B?Y3VycmFt?= wrote:
dim olns
Dim pgRequest

Function Item_Open()

msgbox "open form"
Set olns = Application.GetNameSpace("MAPI")
'Set the page
Set pgRequest = Item.GetInspector.ModifiedFormPages("Main")
msgbox "open"
End Function


Sub Item_CustomPropertyChange(ByVal Name)
on error goto 0
Set olns = Application.GetNameSpace("MAPI")
'Set the page
Set pgRequest = Item.GetInspector.ModifiedFormPages("Main")
msgbox "property"
....
End Sub

I receive the error message Object doesn't support this property or method:
'item.getinspector'" citing the line in the Item_CustomPropertyChange sub.
Then for each field on the form I get "You do not have appropriate
permissions to perform this operation". The "item_open" code never fires.

If I remove the Item_CustomPropertyChange sub code, the item_open code
executes without error.

Do you have ideas as to what is wrong?

Thanks

Since pgRequest is dim'd globally, initialized in the Item_Open event, and not
set to nothing anywhere, it can be used as long as the Item is open. It
really constitutes the "module-level Boolean variable" that Sue speaks of.
So, everywhere you want to return to your main page, just do pgRequest.show
and the main page will appear. However, you should correct your
Item_CustomPropertyChange sub code to use the expected Case format code, so
that it just fires in the case of your custom property changing. Otherwise,
you will have the main page flashing up every time you complete a field.

--
Hollis Paul
Mukilteo, WA USA



  #5  
Old September 27th 07, 04:51 PM posted to microsoft.public.outlook.program_forms
Hollis Paul
external usenet poster
 
Posts: 242
Default Form called by actions...

In article ,
=?Utf-8?B?Y3VycmFt?= wrote:
Thank you for your responses...any other ideas?

This statement looks strange to me: "on error goto 0". I never used
anything but on error go to Next. It could be that goto 0 is a feature
that is not supported in VBScript. I would assume that, if you do not
get the Item-Open event when the property change sub is included, the
script engine is quitting when it can't load the entire script without
error. You should back out the suspect sub and bring it back line by
line to see what produces the failure.

--
Hollis Paul
Mukilteo, WA USA


  #6  
Old September 27th 07, 06:19 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Form called by actions...

VBScript only supports On Error Resume Next.

On Error GoTo 0 or On Error GoTo ErrHandler type handling are for VB/VBA and
won't work at all with VBScript.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Hollis Paul" wrote in message
...
In article ,
=?Utf-8?B?Y3VycmFt?= wrote:
Thank you for your responses...any other ideas?

This statement looks strange to me: "on error goto 0". I never used
anything but on error go to Next. It could be that goto 0 is a feature
that is not supported in VBScript. I would assume that, if you do not
get the Item-Open event when the property change sub is included, the
script engine is quitting when it can't load the entire script without
error. You should back out the suspect sub and bring it back line by
line to see what produces the failure.

--
Hollis Paul
Mukilteo, WA USA



  #7  
Old September 27th 07, 11:01 PM posted to microsoft.public.outlook.program_forms
Hollis Paul
external usenet poster
 
Posts: 242
Default Form called by actions...

In article , Ken Slovak - [MVP -
Outlook] wrote:
On Error Resume Next

Thanks, Ken, for the save. This old brain could only come up with on
Error goto Next, but that didn't seem right, either.

--
Hollis Paul
Mukilteo, WA USA


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Actions and Form Fields dch3 Outlook - Using Forms 3 August 2nd 07 08:15 PM
ContactItem Write event not getting called Dave Add-ins for Outlook 1 April 19th 07 06:44 AM
I have 2 folders both called Contacts. How do I get back to one? baffled_ken Outlook - Using Contacts 4 February 27th 07 10:33 PM
DBX file called Folders Ken Outlook Express 2 November 12th 06 07:39 PM
Outlook addin being called form Word [email protected] Add-ins for Outlook 1 October 3rd 06 10:51 PM


All times are GMT +1. The time now is 12:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.