Copy folder using variables

MicroStation CE U11

I am trying to do a few things, create a folder if it does not exist, and then copy a folder from one location to another using variables that define the source folder and the location that the source folder is to be placed in. So far I am successful in creating the folder but for the copy folder part, it errors out. Any ideas? When I place the full path in the to and from it works, but when I try to use variables, it errors.

Below is an example of what I am thinking. The goal is to use variables available from the configuration in the event the workspace resources are different for different clients. No hard paths like "C:\folder\".

Sub BVEClashDetectionSetup()
    Dim LOCATIONA As String
    Dim LOCATIONC As String
    Dim strDir1 As String
    Dim objFSO As Object
   
    ' Define locations for resources
    LOCATIONA = ActiveWorkspace.ConfigurationVariableValue("LOCATIONA") 'from location
    USTNCE_Root = ActiveWorkspace.ConfigurationVariableValue("_USTN_HOMEROOT") 'assist to create to location
   
    ' Create directory if does not exist
    strDir1 = USTNCE_Root & "newfolder" 'to location
    If Dir(strDir1, vbDirectory) = "" Then
        MkDir strDir1
    ' Copy resources from workspace to local
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        'objFSO.copyFolder "C:\Path\to\source\folder", "C:\Path\to\destination\folder"
        objFSO.CopyFolder LOCATIONA, strDir1
    Else
    ' Error checking
        ShowMessage "FolderA Already Exists!!!"
    End If
 
End Sub

Thanks ahead of time!!!

Mark W.

Parents Reply Children
No Data