Hello!
I am trying to write a macro that will loop through all files in a folder, unhide all tabs, and then save and close - i expected this to be simple but i am struggling to find anything that i can get to run! I'm not sure if the files being downloaded from sharepoint is making a difference and so i have tried putting in a line to remove the protected view but nothing seems to work. I have tried lots of examples from various places (not enough experience to write from scratch yet!) this is the latest code....any ideas?
Sub LoopAllFilesInAFolder()
'Loop through all files in a folder
Dim fileName As Variant
Dim WS As Worksheet
fileName = Dir("C:\Users\uploadedfiles\*.xlsm")
WS.ActiveProtectedViewWindow.Edit
While fileName <> ""
'Insert the actions to be performed on each file
'This example will print the file name to the immediate window
For Each WS In Worksheets
WS.Visible = True
Next
'Set the fileName to the next file
fileName = Dir
Wend
End Sub
I am trying to write a macro that will loop through all files in a folder, unhide all tabs, and then save and close - i expected this to be simple but i am struggling to find anything that i can get to run! I'm not sure if the files being downloaded from sharepoint is making a difference and so i have tried putting in a line to remove the protected view but nothing seems to work. I have tried lots of examples from various places (not enough experience to write from scratch yet!) this is the latest code....any ideas?
Sub LoopAllFilesInAFolder()
'Loop through all files in a folder
Dim fileName As Variant
Dim WS As Worksheet
fileName = Dir("C:\Users\uploadedfiles\*.xlsm")
WS.ActiveProtectedViewWindow.Edit
While fileName <> ""
'Insert the actions to be performed on each file
'This example will print the file name to the immediate window
For Each WS In Worksheets
WS.Visible = True
Next
'Set the fileName to the next file
fileName = Dir
Wend
End Sub