Rick, Also, your line: > If TypeName( accObj.EventWindow) = "Empty" Then Should probably be: If accObj.eventWindow is nothing then Because I don't ever think it will evaluate to empty.
Chip Chip Orange Florida Public Service Commission Computer Systems Analyst 850-413-6314 -----Original Message----- From: Scripting [mailto:[email protected]] On Behalf Of Steve Clower via Scripting Sent: Tuesday, March 24, 2015 12:13 PM To: Rick Thomas; Window-Eyes Scripting List Subject: Re: VS2013: accObj.Name invalid? Rick, accObj.Name is a string and not an object, thus you should use If accObj.Name = "" Then Steve On 3/24/2015 12:05 PM, Rick Thomas via Scripting wrote: > I get an Object is undefined for the if statement referencing accObj.Name > property below: > Sub OnObjectFocus(accObj) > accObj.Prefetch apAll > > If accObj Is Nothing Then > Exit Sub > End If > If TypeName( accObj.EventWindow) = "Empty" Then > Exit Sub > End If > If TypeName( accObj.Name) = "Empty" Then > Exit Sub > End If > [The below line is throwing the error] > If accObj.Name Is Nothing Then > Exit Sub > End If > Logger( accObj.Name & " " & accObj.Role & "accObjRole in Focus") > ... > What am I missing? > I saw the Name property as a Prooperty of the Accessible Object and if I > don't test it for nothing I can print out a bunch of lines with the > accObj.Name property displaying the appropriate strings until it blows the > print statement, invalid parm passed in the line to be printed string I > guess. > In any event, what am I doing wrong above and why is the accObj.Name, or the > Nothing? Throwing an error and why does the error message say undefined is > in column 1 of that statement? Is the If keyword used incorrectly? > Am I just missing something obvious? > Rick USA > > _______________________________________________ > Any views or opinions presented in this email are solely those of the author > and do not necessarily represent those of Ai Squared. > > For membership options, visit > http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/sclower%40aisquared.com. > For subscription options, visit > http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com > List archives can be found at > http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com > _______________________________________________ Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Ai Squared. For membership options, visit http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/corange%40psc.state.fl.us. For subscription options, visit http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com List archives can be found at http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com _______________________________________________ Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Ai Squared. For membership options, visit http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/archive%40mail-archive.com. For subscription options, visit http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com List archives can be found at http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com
