January 23, 200521 yr Hello,I need to find out how to replace one file with another in Visual Basic 6. Say I need to replace the file C:\Program Files\Folder\test.txt with the file C:\Program Files\documents\test.txt . How would I write that? Thank You for your help
January 23, 200521 yr Using the default VB6 library you can do it like that...Kill "C:\Program Files\Folder\test.txt"FileCopy "C:\Program Files\documents\test.txt", "C:\Program Files\Folder\test.txt"It's not the perfect code but it work (with an error handler).To prevent an error with Kill you can remove the read-only attribute with SetAttr before calling Kill.And it's not a good idea to have hard coded path like that (use variable instead).
Create an account or sign in to comment