We help IT Professionals succeed at work.

Is Nested

AmishTaxi
AmishTaxi asked
on
Hello Experts,

I am trying to use VBA in Excel to find out if the active worksheet is embeded in a browser or not.

On Excel 2003, I've tried ".parent.name" but it returns, "Microsoft Excel" and not the browser that it is opened up in.


Any ideas here?
Comment
Watch Question

AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT
Commented:
Does this do what you want:
.parent.parent.name

(Note you may have to check if .parent has actually got a parent before trying to get the name.)

Author

Commented:
Hi AndyAinscow,

That was a good idea you had.  I also tried the following with no luck:

   ThisWorkbook.Parent.Parent.Parent.Name
   Excel.Parent.Parent.Name
   Application.Parent.Parent.Name
   Application.Parent.Name


Basically, this is an Excel 2003 Macro running inside of Windows Internet Explorer which the end-users are accessing through Citrix.  The strange part here is that a lot of the Excel functionality is there but some sections of code that need to be flagged.

I am in the process of fully qualifing my Excel references which does help and I also would like to add this boolean function to throw a flag if Excel Is_Nested inside another application.

Thanks again for helping out!
JF
Hello,

I just wanted to give an update that the answer was to basically not test to see if it was nested and basically fully qualify the Excel Objects (Example: use "ThisWorkbook.Sheets [...]" instead of just "Sheets[...]")

Cool, thanks for your help!

Author

Commented:
I split this because I felt the first response was very helpful in leading to the right answer (clearly defining all references)

Thanks for your help!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.