My document folders

I’m trying to open a folder in my documents in front of the rhino program. I can get this to work in different locations other than the my documents folder. I get the right address on the error message but it does not seem to be able to find the folder.

  • List item
Sub folder()
	
	Dim objShell, strDocuments, file, strPath
	'file = "Profiles"
	Set objShell = CreateObject("WScript.Shell")
	strDocuments = objShell.SpecialFolders("MyDocuments")
	strPath = strDocuments
	'MsgBox strDocuments & "\jewelerscad\" & file	
	Call RunMe(strDocuments & "\jewelerscad\")
	
End Sub

Function RunMe(strPath)
	Dim shell
	On Error Resume Next
	Set shell = CreateObject("WScript.Shell")
	shell.Run("" & strPath & ""), 1, False
	If Err.Number <> 0 Then
		MsgBox "Unable to execute """ & strPath & """", 16
		Err.Clear
	End If
	Set shell = Nothing
End Function

How about this?

Option Explicit

Call OpenJewelersCadFolder

Sub OpenJewelersCadFolder
	
  Const FOLDER = "\JewelersCad\"
  Dim objShell, strFolder
	
  Set objShell = CreateObject("WScript.Shell")
  strFolder = objShell.SpecialFolders("MyDocuments")
  strFolder = strFolder & FOLDER
  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