ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Capture if Spreadsheet is open in IE and not Excel (https://www.excelbanter.com/excel-programming/325935-how-capture-if-spreadsheet-open-ie-not-excel.html)

UBER_GEEK

How to Capture if Spreadsheet is open in IE and not Excel
 
Constantly i find people are opening my forms which contain programming
in IE. Unfortunetly some code will not perform correctly in Ie, and
instead of figuring out what dosnt, It would be very convenient if
there were a way to tell if the spreadsheet's in ie or excel. Anyone
got any idea's?

Thanks


K Dales[_2_]

How to Capture if Spreadsheet is open in IE and not Excel
 
There was a similar post not long ago: The solution is to check the Container
property of the workbook, which "Returns the object that contains the
specified embedded workbook." If the workbook is open in IE then
ThisWorkbook.Container.Name will be "Microsoft Internet Explorer." If it is
open in Excel, there is no "container" since it is not embedded, and the
property call will error out, so you need error trapping to catch that:

Public Function ExcelOrIE() As String
Dim CName as String

On Error Goto MustBeExcel
CName = ThisWorkbook.Container.Name

If CName = "Microsoft Internet Explorer" Then CName = "IE" Else CName =
"Something Else"

ExcelOrIE = CName
Exit Function

MustBeExcel:
ExcelorIE = "Excel"

End Function

"UBER_GEEK" wrote:

Constantly i find people are opening my forms which contain programming
in IE. Unfortunetly some code will not perform correctly in Ie, and
instead of figuring out what dosnt, It would be very convenient if
there were a way to tell if the spreadsheet's in ie or excel. Anyone
got any idea's?

Thanks




All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com