Finde Antworten, stelle Fragen und schließe dich mit unserer Community zusammen.

Startseite Forums Excel VBA TESSST

  • VBA

    TESSST

    Posted by Excel Community on 23. Februar 2025 at 13:58

    Sub VBAAdvancedRenameFile()

    'Create variables to hold file names
    Dim filePath As String
    Dim newFilePath As String

    filePath = "C:\Users\marks\Documents\Example File.xlsx"
    newFilePath = "C:\Users\marks\Documents\Example File Renamed.xlsx"

    'Ignore errors
    On Error Resume Next

    'Rename file
    Name filePath As newFilePath

    'Display message if error occured
    If Err.Number <> 0 Then
    MsgBox Prompt:="Unable to rename file", Buttons:=vbOK, _
    Title:="Rename file error"
    End If

    'Turn error checking back on
    On Error GoTo 0

    End Sub

    Excel Community replied 2 weeks, 3 days aktiv. 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.