I have revised my code. I have added a new variant as the destination, and all the variants are working in the former msgboxes.
I have msgboxes to keep track of what is happening. The last msgbox where I have Copy: to... Is not working and getting a compile error. I don't know why?
Code:Private Sub cmdRenameCopy_Click() 'Declare a variable as a FileDialog object. Dim fd As FileDialog 'Create a FileDialog object as a File Picker dialog box. Set fd = Application.FileDialog(msoFileDialogOpen) 'Declare a variable to contain the path 'of each selected item. Even though the path is aString, 'the variable must be a Variant because For Each...Next 'routines only work with Variants and Objects. Dim OrigPath As Variant Dim OP As Variant Dim NNPath As Variant Dim NFPath As Variant 'Use a With...End With block to reference the FileDialog object. With fd 'Use the Show method to display the File Picker dialog box and return the user's action. 'The user pressed the button. 'If .Show = -1 Then 'Step through each string in the FileDialogSelectedItems collection. 'For Each vrtSelectedItem In .SelectedItems If fd.Show = True Then For Each OrigPath In fd.SelectedItems NNPath = Left(OrigPath, InStrRev(OrigPath, "\")) & NewName & Mid(OrigPath, InStrRev(OrigPath, ".")) MsgBox NNPath Name OrigPath As NNPath NFPath = FullPath & "\" & NewName & Mid(NNPath, InStrRev(NNPath, ".")) MsgBox NFPath MsgBox "Copy:" & _ vbCrLf & "" & _ vbCrLf & NNPath & _ vbCrLf & "To" & _ vbCrLf & NFPath & _ vbOKCancel + vbQuestion, _ "Accept or Cancel" FileCopy NNPath, NFPath MsgBox "File Copy Successful" Next ' Next End If 'vrtSelectedItem is a string that contains the path of each selected item. 'You can use any file I/O functions that you want to work with this path. 'This example displays the path in a message box. ' Next vrtSelectedItem 'The user pressed Cancel. 'Else 'End If End With 'Set the object variable to nothing. Set fd = Nothing