Does anyone know how I can program a button on a E-Mail to copy a file from a network drive to a local drive when clicked? I know how to create the button, but I don't know the code to preform this function. Thanks for any help.
The syntax is:
FileCopy sourcefile, destinationfile
Warning: If the destinationfile already exists, it will be overwritten.
You can use the DIR function to check for this- Dir(filepath&name) will return a null string ("" if the file does not exists.
Here's an example that shows both:
Code:
Sub Click(Source As Button)
If Dir("C:\Test.txt") = "" Then
Filecopy "C:\windows\desktop\Test.txt","C:\Test.txt"
Else
Messagebox "Cannot copy- Destination file already exists."
End If
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.