File renaming in VB6

Maintaining a legacy application written in VB6.

Several files are read in, modified, and written out. It is advisable for the user to preserve the original files, “just in case”. Currently, the user is required to manually copy each “Name.txt” to “Name_bak.txt”. Then, when the application is run, Name_bak.txt is read in, and the modified file is written out as Name.txt.

It would be convenient to automate this. I could read Name.txt in, immediately write it out as Name_bak.txt, then proceed with the modifications, creating a new Name.txt.

Question: Is there a way in VB6 to do this file archiving (renaming) directly? Some of the files are excel spreadsheets, and they are complicated to read in and write out, cell by cell.
NormaPosyPhysicistAsked:
Who is Participating?
 
David Johnson, CD, MVPOwnerCommented:
It would be convenient to automate this. I could read Name.txt in, immediately write it out as Name_bak.txt, then proceed with the modifications, creating a new Name.txt.
VB6 is no longer a supported coding platform and hasn't been for over 10 years

Rather than read in and then out use the renameFile option
My.Computer.FileSystem.RenameFile("C:\Test.txt", "SecondTest.txt")

Open in new window

0
 
aikimarkCommented:
Is this an Excel/VBA problem or actually a VB6 problem
1
 
NormaPosyPhysicistAuthor Commented:
Thank you.

Yes, I know that VB6 is long in the tooth. This is a legacy program that I am maintaining, important for those who use it. It is a rather large and complex project. Needs to be entirely rewritten from scratch in some modern language. By somebody else.  I'm 84 and ought to be retired.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.