Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename file from Visual Basic6

Status
Not open for further replies.

thoms

Programmer
May 27, 2002
4
BE
Hi

Can I rename a file from VB6?
If so, how?

Thank you,

Thoms
 
I found this in the help file.

Name "C:\config.sys" As "C:\config.bak"

 
Add a reference to the ms scripting runtime by choosing the menu options Project -> References -> select from the list Microsoft Scripting Runtime.
You can rename a file using the following code:
Dim fsFilesystem As Scripting.FileSystemObject
Set fsFilesystem = New Scripting.FileSystemObject
fsFilesystem.MoveFile "c:\test.txt", "c:\success.txt"
Set fsFilesystem = Nothing
 
Yes, thank you, it works.
Sorry if it was stupid question, but my help file opens the MSDN which give me more problems than info.

Thanx again.

Thoms
 
Great question. I just didn't want to take credit for something I didn't know.
RKA:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top