Now I'm really confused, how can a User make a selection in a workbook you
don't want hime to see. OK, I guess you don't mean that, if you mean open a
workbook keep it hidden, do stuff for a while and let user interact with the
interface, then close the hidden workbook, try something like this -
Sub test1()
Dim sName As String
Dim wb As Workbook
sName = "myFile.xls"
Application.ScreenUpdating = False
Set wb = Workbooks.Open(Filename:= _
"C:\<path>" & sName)
wb.Windows(1).Visible = False
wb.Saved = True
Application.ScreenUpdating = True
MsgBox wb.Name & " is open and hidden"
End Sub
Sub test2()
Dim bSaved As Boolean
Dim sName As String
Dim wb As Workbook
sName = "myfile.xls"
Set wb = Workbooks(sName)
bSaved = wb.Saved
If bSaved = False And wb.Windows(1).Visible = False Then
Application.ScreenUpdating = False
wb.Windows(1).Visible = True
Application.ScreenUpdating = True
wb.Close True ' save & close
Application.ScreenUpdating = True
Else
wb.Close False
End If
End Sub
If this still does not cover what you want, as I asked before, try and
explain otherwise it leaves everyone trying to second guess what you're
after.
Regards,
Peter T