Closing folder

I’m trying to close the folder that I have previously opened

what I used to open the folder

Sub folderCad_Pile()

  Dim objShell, strFolder, file

  Const FOLDER = "\Jewelerscad\Cad_Pile\"  

  Set objShell = CreateObject("WScript.Shell")
  strFolder = objShell.SpecialFolders("MyDocuments")
  strFolder = strFolder & FOLDER 

  'MsgBox strFolder 

  Call OpenFolder(strFolder)

End Sub


Sub OpenFolder(strFolder)

  Const COMMAND = "Explorer.exe / e,"
  Dim objFSO, objShell, strError, strCommand

  Set objFSO = CreateObject("Scripting.FileSystemObject")
  If Not objFSO.FolderExists(strFolder) Then
	strError = "Folder not found - " & strFolder		
	Call MsgBox(strError, vbOKOnly + vbCritical, "Open Folder")
	Exit Sub
  End If

  Set objShell = CreateObject("WScript.Shell")
  strCommand = COMMAND & strFolder
  Call objShell.Run(strCommand)

End Sub

Hi @cadguy,

You’ll probably need to Goggle the topic if you still want to find a solution.

– Dale