Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

VBA - checking for existance of a property

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
B - 24 May 2008 16:30 GMT
Hi All,

I'm making a function that works with the Range.Comment object.

There's Comment.Text, but if there's nothing in it, it just errors
out.

How to check if .Text exists or not before attempting to read from it?

Thanks
Bernie Deitrick - 24 May 2008 16:40 GMT
B,

Use the error to your advantage:

Sub Test()
Dim myT As String

On Error Resume Next
myT = "No Comment!"
myT = ActiveCell.Comment.Text
MsgBox IIf(myT = "", "Comment is blank", myT)

End Sub

> Hi All,
>
[quoted text clipped - 6 lines]
>
> Thanks
B - 24 May 2008 17:03 GMT
On May 25, 1:40 am, "Bernie Deitrick" <deitbe @ consumer dot org>
wrote:
> B,
>
[quoted text clipped - 20 lines]
>
> > Thanks

Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.