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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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