[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

File Names

How do you change the name of a given file through VB?
0
zbrusko
Asked:
zbrusko
1 Solution
 
sonusCommented:
Use "Name".  Syntax is

Name [oldpathname] As [newpathname]

0
 
Erick37Commented:
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

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now