VBA learner ITG
Active Member
- Joined
- Apr 18, 2017
- Messages
- 272
- Office Version
- 365
- Platform
- Windows
- MacOS
Good morning,
I have the below script that works perfectly well on a windows machine. However it doesnt run on a Mac Operating system.
Can I get your guidance on what I need to do to the code?
I have the below script that works perfectly well on a windows machine. However it doesnt run on a Mac Operating system.
Can I get your guidance on what I need to do to the code?
Sub WindowsRenameScript()
'
' RenameScript Macro
Dim xDir As String
Dim xFile As String
Dim xRow As Long
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = -1 Then
xDir = .SelectedItems(1)
xFile = Dir(xDir & Application.PathSeparator & "*")
Do Until xFile = ""
xRow = 0
On Error Resume Next
xRow = Application.Match(xFile, Range("A:A"), 0)
If xRow > 0 Then
Name xDir & Application.PathSeparator & xFile As _
xDir & Application.PathSeparator & Cells(xRow, "B").Value
End If
xFile = Dir
Loop
End If
End With
End Sub