Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5809

Closing folder

$
0
0

@cadguy wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5809

Trending Articles