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.
Norma PosyPhysicistAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aikimarkCommented:
Is this an Excel/VBA problem or actually a VB6 problem
1
Norma PosyPhysicistAuthor 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Spreadsheets

From novice to tech pro — start learning today.