A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Retreiving a Directory



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2004, 09:51 PM
joethis
external usenet poster
 
Posts: n/a
Default 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  
Old June 2nd, 2004, 04:37 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.