If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Retreiving a Directory
Is there an object that will allow you to get a directory of a file? What I want to be able to do is get a directory of a file and copy that file to another location.
|
#2
|
|||
|
|||
Retreiving a Directory
Joethis,
'The following will retrieve the path to the specified file: sPath = Replace(sFileName, Dir(sFileName, vbNormal), "") 'The following will move a file from one location to another: Name sFileName As sNewFileName But to do that you need three things: 1. The existing filename (including its current path), which is given by you in sFileName. 2. The filename portion, which is given by the following code: Dir(sFileName, vbNormal) 3. The new path (excluding the filename), which is given by you in sNewPath. Therefore, the code should be: sFile = Dir(sFileName, vbNormal) Name sFileName As sNewPath & "\" & sFile Regards, Graham R Seach Microsoft Access MVP Sydney, Australia Microsoft Access 2003 VBA Programmer's Reference http://www.wiley.com/WileyCDA/WileyT...764559036.html "joethis" wrote in message ... Is there an object that will allow you to get a directory of a file? What I want to be able to do is get a directory of a file and copy that file to another location. |
Thread Tools | |
Display Modes | |
|
|