Please help with file copying in VBA!!

smpayne

Registered User.
Local time
Yesterday, 19:19
Joined
Sep 29, 2004
Messages
27
Is this possible?? I am doing this with a 3rd party macro right now, but would like it in VBA so I can run it directly from access prior to my queries. Basically what the query below does is look at the source path for a filename that has the current date in it, and if it's todays date, it copies and renames it to the destination path. Is there a VBA God on here somewhere that can help me translate into VBA, which is not my area of expertise?????

Let>SourcePath=S:\CTV
Let>DestPath=\\MINT02\Share\SHARE\SMP\DialerRecon
Let>CF_OVERWRITE=1

Month>MM
Day>DD
Year>YYYY
MidStr>%YYYY%,3,2,YY
Let>FileName=%MM%%DD%%YY%pool55inv.txt
Let>NewFileName=pool55inv.txt


IfFileExists>%SourcePath%\%FileName%,CopyIt
MessageModal>File %Filename% was NOT found in %SourcePath%%CRLF%CRLF%No file copied. Process Stopped.
Goto>End

Label>CopyIt
CopyFile>%SourcePath%\%FileName%,%DestPath%\%NewFileName%

MessageModal>File %Filename% was found in %SourcePath%.%CRLF%%CRLF%. File was copied to %DestPath%.

IfFileExists>%DestPath%\%NewFileName%,Success,Fail

Label>Success
MessageModal>File Found
Goto>End

Label>Fail
MessageModal>File Not Found
Goto>End

Label>End


I appreciate any help!!

Shawn.
 
The object browser in Access might be a start - go for a new module in the database window, click on object browser, select VBA from the dropdown and type 'copy' into the search box. There are various DOS type options in the 'filesystem' class as I recall. Sorry, too tired / cold to be able to help further at the moment.

Tay
 

Users who are viewing this thread

Back
Top Bottom