Solved

File Names

Posted on 2000-03-09
2
153 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Link a textbox in excel to a cell with more than 255 characters. 5 84
Adding to a VBA? 6 69
vb6 connector to SQL Server 2 37
vb6 connector to mongodb 2 81
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

776 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