Hello all,
Going out of my mind trying to get this to work. I have a really long macro that I would like to run on all files in a folder. I get a run time error on line:
Filename = Dir(Pathname & "*.xlsx")
that says "Device Unavailable".
I have read many things talking about using ":" instead "/" but I have tried both. I have also ready that macs can not use wildcards (e.g., "*") but I have seen a number of people using macs not have a problem with this.
Does anyone see what I am doing wrong here?
Thanks in advance for your help.
Sub ProcessFiles()
Dim Filename As String
Dim Pathname As String
Dim wb As Workbook
Pathname = "OWC SSD/Users/wtmccu2/Desktop/dir1/dir2/dir_with_files/"
Filename = Dir(Pathname & "*.xlsx")
Do While Filename <> ""
Set wb = Workbooks.Open(Pathname & Filename)
DoWork wb
wb.Close SaveChanges:=True
Filename = Dir()
Loop
End Sub
Sub DoWork(wb As Workbook)
With wb
'starts long macro i want to run. this is just the first line
ActiveSheet.Name = "Receptive"
End With
End Sub
Bookmarks