Trying to close Excel Application in IE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

From a Excel workbook opened in IE, I want to use a Macro button to run VB
code to close the workbook, Quit the Application and return to IE. The code I
have seems to work outside IE but not in the IE environment.

Macro1()
If IsEmpty(ActiveSheet.Range("c66")) Then
MsgBox "Please enter Confirmation!"
Exit Sub
End If

Dim sPath As String
sPath = "\\J:\html\Content\Direct\Manu\MAN_LOGISTICS_IPT\qms
mk2\BaaNFormSub\"

On Error Resume Next
ActiveWorkbook.Saveas sPath & ActiveSheet.Range("c4").Value
If Err.Number <> 0 Then
MsgBox "File not saved!" & vbLf & "contact 65128"
Err.Clear
End If

For Each w In Application.Workbooks
w.Close
Next w
Application.Quit

End Sub
 
Dave,
Thanks for that. Unfortunately this workbook is to be accessed by
many users and changing the settings as you suggest is not allowed in our
current environment.
From a different angle, would it be possible to turn IE off, manipulate the
Workbook close Excel down and then recall IE ?
 
I don't know how to do that.

Maybe someone else can jump in with a better solution.
 

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

Back
Top