![]() |
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
|
|||
|
|||
![]()
This is really a general VBA problem but it's come up in Outlook so I thought
I'd post it here. Is there any way of testing for an empty property, i.e. one that's been set to Nothing? I've tried all the functions like IsEmpty, IsNull, IsMissing, etc but I've ended up having to settle for a rather clumsy error routine that catches error 91. The particular case in which I'm having problems is using Redemption: in the CurrentItem_PropertyChange event (for ThisOutlookSession module) I've set the SafeItem equal to the CurrentItem but for some reason the SentOnBehalfOfName doesn't come across, even though I've preceded this line with a CurrentItem.Save (the strange thing about this is that it worked fine when run in the CurrentItem_Send event - I guess it's something to do with trying to save an entire message before one of its properties has been updated). As a work around, I'm using SafeItem.Sender.Name (a property I spotted in the Locals window while stepping through the code). This works fine unless the From box is empty in which case SafeItem.Sender.Name ceases to exist at all and SafeItem.Sender becomes Nothing - rather than a Null or an empty string which could be more easily tested for. Any ideas gratefully received... |
Ads |
#2
|
|||
|
|||
![]()
In vbscript/vb6 the syntax is:
If Not (obj Is Nothing) Then In VB.NET 8.0, it's: If obj IsNot Nothing Then -- Josh Einstein Einstein Technologies Microsoft Tablet PC MVP Tablet Enhancements for Outlook 2.0 - Try it free for 14 days www.tabletoutlook.com "Martin" wrote in message ... This is really a general VBA problem but it's come up in Outlook so I thought I'd post it here. Is there any way of testing for an empty property, i.e. one that's been set to Nothing? I've tried all the functions like IsEmpty, IsNull, IsMissing, etc but I've ended up having to settle for a rather clumsy error routine that catches error 91. The particular case in which I'm having problems is using Redemption: in the CurrentItem_PropertyChange event (for ThisOutlookSession module) I've set the SafeItem equal to the CurrentItem but for some reason the SentOnBehalfOfName doesn't come across, even though I've preceded this line with a CurrentItem.Save (the strange thing about this is that it worked fine when run in the CurrentItem_Send event - I guess it's something to do with trying to save an entire message before one of its properties has been updated). As a work around, I'm using SafeItem.Sender.Name (a property I spotted in the Locals window while stepping through the code). This works fine unless the From box is empty in which case SafeItem.Sender.Name ceases to exist at all and SafeItem.Sender becomes Nothing - rather than a Null or an empty string which could be more easily tested for. Any ideas gratefully received... |
#3
|
|||
|
|||
![]()
..Sender is an AddressEntry object so it's Nothing if not instantiated.
Use this: If (Not (SafeItem.Sender Is Nothing)) Then 'ok to use Else 'some error handling End If -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Martin" wrote in message ... This is really a general VBA problem but it's come up in Outlook so I thought I'd post it here. Is there any way of testing for an empty property, i.e. one that's been set to Nothing? I've tried all the functions like IsEmpty, IsNull, IsMissing, etc but I've ended up having to settle for a rather clumsy error routine that catches error 91. The particular case in which I'm having problems is using Redemption: in the CurrentItem_PropertyChange event (for ThisOutlookSession module) I've set the SafeItem equal to the CurrentItem but for some reason the SentOnBehalfOfName doesn't come across, even though I've preceded this line with a CurrentItem.Save (the strange thing about this is that it worked fine when run in the CurrentItem_Send event - I guess it's something to do with trying to save an entire message before one of its properties has been updated). As a work around, I'm using SafeItem.Sender.Name (a property I spotted in the Locals window while stepping through the code). This works fine unless the From box is empty in which case SafeItem.Sender.Name ceases to exist at all and SafeItem.Sender becomes Nothing - rather than a Null or an empty string which could be more easily tested for. Any ideas gratefully received... |
#4
|
|||
|
|||
![]()
Thanks to both of you: what I needed.
"Ken Slovak - [MVP - Outlook]" wrote: ..Sender is an AddressEntry object so it's Nothing if not instantiated. Use this: If (Not (SafeItem.Sender Is Nothing)) Then 'ok to use Else 'some error handling End If -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Martin" wrote in message ... This is really a general VBA problem but it's come up in Outlook so I thought I'd post it here. Is there any way of testing for an empty property, i.e. one that's been set to Nothing? I've tried all the functions like IsEmpty, IsNull, IsMissing, etc but I've ended up having to settle for a rather clumsy error routine that catches error 91. The particular case in which I'm having problems is using Redemption: in the CurrentItem_PropertyChange event (for ThisOutlookSession module) I've set the SafeItem equal to the CurrentItem but for some reason the SentOnBehalfOfName doesn't come across, even though I've preceded this line with a CurrentItem.Save (the strange thing about this is that it worked fine when run in the CurrentItem_Send event - I guess it's something to do with trying to save an entire message before one of its properties has been updated). As a work around, I'm using SafeItem.Sender.Name (a property I spotted in the Locals window while stepping through the code). This works fine unless the From box is empty in which case SafeItem.Sender.Name ceases to exist at all and SafeItem.Sender becomes Nothing - rather than a Null or an empty string which could be more easily tested for. Any ideas gratefully received... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Redemption | Christoph | Add-ins for Outlook | 5 | March 6th 06 03:26 PM |
News server name for software testing -reg | thirumalai | Outlook - General Queries | 1 | February 12th 06 09:12 AM |
Testing my first Email | jratkins | Outlook Express | 1 | February 11th 06 02:15 PM |
Testing | William Brady | Outlook - General Queries | 0 | February 3rd 06 05:31 PM |
Redemption MAPITable | Dmitry Streblechenko | Add-ins for Outlook | 1 | January 12th 06 04:09 AM |