Option Compare Database Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Const WM_CLOSE = &H10 Function OtvoriFolder() Dim ImeFoldera As String ImeFoldera = "D:" Shell "C:\WINDOWS\explorer.exe """ & ImeFoldera & "", vbNormalFocus End Function Function ZatvoriFolder() Dim winHwnd As Long Dim RetVal As Long Dim ImeFoldera As String ImeFoldera = "D:" winHwnd = FindWindow(vbNullString, ImeFoldera) If winHwnd <> 0 Then PostMessage winHwnd, WM_CLOSE, 0&, 0& Else MsgBox "NIJE OTVOREN" End If End Function