![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |