Share via

ChDir not working

Anonymous
2018-01-11T20:57:51+00:00

as I step thru the code below the Chdir command does not seem to work.

Note that the existing directory is a network drive

         CTRS_Build_BOM_PATH = "C:\CMSynergy\17.17.99\ctrs\CTRStool_MSWord_Build_BOM"

         'Current directory must be Build BOM Path for this to work

         frmAssemble.txtBOMPath = CTRS_Build_BOM_PATH

    End If

    If CTRS_Build_BOM_PATH <> "" Then

        'Running from batch file that sets the environment parameter CTRStool_BUILD_BOM_PATH

        frmAssemble.txtBOMDrive = Left$(CTRS_Build_BOM_PATH, 1)

    End If

    'Set the current Directory for objOpenDialog to start from

    ChDrive frmAssemble.txtBOMDrive                 '   Point to user's drive

    ChDir frmAssemble.txtBOMPath                    '   Point to user's directory

Watch window always shows CurDir as the roaming one

Watch :   : CurDir : "C:\Users\LZ0FMH\AppData\Roaming\Microsoft\Templates" : Variant/String : frmAssemble.btnBrowseBOM_Click

Watch : + : frmAssemble.txtBOMPath : "C:\CMSynergy\17.17.99\ctrs\CTRStool_MSWord_Build_BOM" : Object/TextBox : frmAssemble.btnBrowseBOM_Click

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2018-01-12T18:08:01+00:00

    PLEASE IGNORE. ChDir does work.  

    The issue is due to tooling issues the test machine had an incorrect path.  So when the line asks to change the directory it fails because on the test machine the path was in correct and the test code hard codes it.

    Was this answer helpful?

    0 comments No comments