VBA in IE window

A

Atishoo

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.
 
P

Peter T

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top