Renames the specified file inside the archive.
object.RenameFile ( ExistingFileName, NewFileName ) |
- ExistingFileName
- Required. A String that represents the existing file name inside the archive.
- NewFileName
- Required. A String that represents the new file name inside the archive.
Boolean
RenameFile Example
Renames a file in a ZIP Archive.
RenameFile Example (VBScript) | Copy Code |
---|---|
Sub RenameFile(strArchiveFile, strCompressedFile, strNewName) ' Open the ZIP archive Dim pArchive Set pArchive = Application.CreateAppObject("Archive") If (Not pArchive.Open(strArchiveFile)) Then Exit Sub ' Rename the file Dim blnResult blnResult = pArchive.RenameFile(strCompressedFile, strNewName) ' Close the ZIP archive pArchive.Close() ' Display the results If (Not blnResult) Then Application.MessageBox "Failed to rename file.", vbCritical, "Error" Else Application.MessageBox strCompressedFile & " renamed to " & strNewName, vbInformation, "Success" End If End Sub |