ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA in IE window (https://www.excelbanter.com/excel-programming/442659-vba-ie-window.html)

Atishoo

VBA in IE window
 
Hi
Im accessing a spreadsheet via a link I have put in a web page. The
spreadsheet opens up in an IE window.
I am wanting to stop the "save changes" dialog box popping up when I close
the window, I cant do this using the usual vba method because it doesnt apply
to IE.
Would like to exit using an "exit" command button, Any idea how to close the
active IE window using VBA?
Am also wanting to open it in full screen (compensate for the lack of a full
screen command for "taget_blank" in HTML)

Any suggestions gratefully received.

Peter T

VBA in IE window
 
Try something like this

Sub CloseMe()
Dim bIsIE As Boolean
Dim objIE As Object

If GetIE(objIE) Then
objIE.FullScreen = False
ThisWorkbook.Saved = True ' prevent Save dialogs
objIE.Quit
End If

End Sub

Function GetIE(objIE As Object) As Boolean

If ThisWorkbook.IsInplace Then
On Error Resume Next
Set objIE = ThisWorkbook.Container
If Not objIE Is Nothing Then
GetIE = InStr(1, TypeName(objIE), "WebBro") 0
End If
End If
End Function

Sub ToggleFullScreen()
Dim objIE As Object
If GetIE(objIE) Then
objIE.FullScreen = Not objIE.FullScreen
End If
End Sub

Put a button on the sheet with its OnAction asigned to "CloseMe"

Not sure about FullScreen, as written it's not same as F11 in IE.

Regards,
Peter T

"Atishoo" wrote in message
...
Hi
Im accessing a spreadsheet via a link I have put in a web page. The
spreadsheet opens up in an IE window.
I am wanting to stop the "save changes" dialog box popping up when I close
the window, I cant do this using the usual vba method because it doesnt
apply
to IE.
Would like to exit using an "exit" command button, Any idea how to close
the
active IE window using VBA?
Am also wanting to open it in full screen (compensate for the lack of a
full
screen command for "taget_blank" in HTML)

Any suggestions gratefully received.





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

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