Recognizing the Active Directory

keith0528

Active Member
Joined
Apr 23, 2009
Messages
250
Greetings,

I have an excel file that is copied into directory Y from directory X. When I run this code


sFile = ActiveWorkbook.Path & "\" & sFile

It still references directory X. How can i get it to recognize that it now resides in directory Y?


thanks
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
12,979
Office Version
  1. 2013
Platform
  1. Windows
You need to use the FileCopy method. For moving between directories, the full name (includes path) needs to be used for source and destination;
Eample:
Code:
FileCopy("C:\Temp\Data.xlsx", "C:\xlFiles\Data.xlsx")
Kill "C:\Temp\Data.xlsx"
 
Upvote 0

Forum statistics

Threads
1,195,669
Messages
6,011,061
Members
441,580
Latest member
BornholmerBjarne

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
Top