Solved

File Names

Posted on 2000-03-09
2
151 Views
Last Modified: 2010-05-02
How do you change the name of a given file through VB?
0
Comment
Question by:zbrusko
2 Comments
 

Accepted Solution

by:
sonus earned 50 total points
ID: 2602828
Use "Name".  Syntax is

Name [oldpathname] As [newpathname]

0
 
LVL 32

Expert Comment

by:Erick37
ID: 2602855
Private Sub Command1_Click()
    Dim sOldFile As String
    Dim sNewFile As String
    sOldFile = "c:\test.log"
    sNewFile = "c:\test2.log"
    On Error GoTo FILEERR
    Name sOldFile As sNewFile
    Exit Sub
FILEERR:
    MsgBox Err.Description & vbCrLf & sOldFile, vbCritical, "ERROR " & CStr(Err.Number)
End Sub
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now