Hui!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I thought you abandoned me : )
Good to hear from you again man. How's Australia life?
Anyway, you pointed me in the right direction.
This basically writes a batch file down and launches it to terminate all open folders.
It refreshes Windows basically.
Hope this helps someone out.
Sub Close_All_Windows_Folders()
'''''''''''''''''''''''''''''''''''''''''''''''''
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.EnableEvents = False
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim BatchFileDataDirFolder As String
Dim BatchFileDataFileName As String
Dim CloseAllFoldersBatchFile As String
Dim FileNumber As Integer
Dim ExecuteBatchFile As Variant
'''''''''''''''''''''''''''''''''''''''''''''''''
BatchFileDataDirFolder = "C:BatchFileDataFolder" '<<<Change Directory Folder
BatchFileDataFileName = "Close.All.Folders.bat" '<<<Change BAT File Name
CloseAllFoldersBatchFile = BatchFileDataDirFolder & "" & BatchFileDataFileName
FileNumber = FreeFile
'''''''''''''''''''''''''''''''''''''''''''''''''
On Error Resume Next
Kill BatchFileDataDirFolder & "*.*"
On Error Resume Next
RmDir BatchFileDataDirFolder
'''''''''''''''''''''''''''''''''''''''''''''''''
MkDir BatchFileDataDirFolder
'''''''''''''''''''''''''''''''''''''''''''''''''
Open CloseAllFoldersBatchFile For Output As #FileNumber
Print #FileNumber, "taskkill /f /im explorer.exe"
Print #FileNumber, "start /d" & """" & "C:Windows" & """" & " EXPLORER.exe"
Print #FileNumber, "exit"
Close #FileNumber
'''''''''''''''''''''''''''''''''''''''''''''''''
ExecuteBatchFile = Shell(CloseAllFoldersBatchFile, vbHide)
'''''''''''''''''''''''''''''''''''''''''''''''''
'Error Assistance
If ExecuteBatchFile = 0 Then
MsgBox "Error : " & Err.Number & vbCrLf & "Description : " & Err.DESCRIPTION, vbCritical
Close #FileNumber
End
End If
'''''''''''''''''''''''''''''''''''''''''''''''''
Application.Wait (Now + TimeValue("0:00:01"))
On Error Resume Next
Kill BatchFileDataDirFolder & "*.*"
On Error Resume Next
RmDir BatchFileDataDirFolder
'''''''''''''''''''''''''''''''''''''''''''''''''
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
'''''''''''''''''''''''''''''''''''''''''''''''''
End Sub