I have the code below to update workbooks from a master, thanks to Leith Ross.

I want to change the code so it uses the original file name rather than add the Temp files. I have tried changing the WkbName to the same as the existing workbooks but the workbooks are write reserved, when I run the code on these workbooks I get the message Error number = 1004, operation failed workbook is write reserved. I do know the password to open the workbooks to enable write access so can add this to the code, if required.

Previous thread
http://www.excelforum.com/showthread...highlight=blue

Thanks Blue



Public Sub UpdateWorkbooks()

Dim Ret
Dim I As Integer
Dim W As Integer
Dim InputMsg As String
Dim WeekStr As String
Dim WkbName As String

On Error GoTo Fault

'Ask for the Week Number
InputMsg = "Enter the Week Number to start with below." & vbCrLf _
&"To Exit this Macro, Click Cancel or leave the entry below blank and Click OK."

WeekStr = InputBox(InputMsg, "Update Workbooks")

If WeekStr = "" Then Exit Sub

W = Val(WeekStr)

'Update Workbooks Loop
For I = W to 52

'Save this Workbook as the New Workbook - Asks to Replace the File
WkbName = ThisWorkbook.Path & "\TEMP WK" & I & ".xls"
ThisWorkbook.SaveAs Filename:= WkbName, FileFormat:= xlWorkbookNormal

Next I

Fault:
Msg = "An Error has occurred. This macro will now Terminate." & vbCrLf _
& "Error Number = " & Err.Number & vbCrLf _
& "Message: " & Err.Description

Ret = MsgBox(Msg, vbOkonly + vbCritical, "Update Workbooks Macro")
Err = 0

End Sub