file path change

kraigt84

New Member
Joined
Jun 11, 2018
Messages
2
Hi all,

I am trying to display the below path in a dialog box after changing the current directory in An Excel Macro. Code Sample:

ChDir "G:\Inventory Management\Daily Audits\BCS"

externWorkbookFilepath2 = "G:\Inventory Management\Daily Audits\BCS"

MsgBox externWorkbookFilepath2

MsgBox "Select BCS Files", vbOKOnly

The end result I am trying to accomplish is to go to the folder and select files. Currently the above does not give me the expected result on the first iteration. When I run the ChDir command later in my code to:

ChDir "G:\Inventory Management\Daily Audits\VNDR"

The appropriate VNDR folder is displayed

My hunch is it is the first time I set the directory that is causing the issue. Subsequent changes work correctly. Does anyone have a work around. Possibly opening another directory cancelling, then opening the directory?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try adding this
Code:
[COLOR=#0000ff]ChDrive "G:"[/COLOR]
ChDir "G:\Inventory Management\Daily Audits\BCS"
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top