I'm saving a workbook as a copy with date. I did it with the code suggested on this site (save as copy).
Now I'm getting an error concerning the links in my new workbook. Is there a way to set the correct links (on the new workbook) to the new workbook together with the save as copy method?
Sub Button15_Click()
ActiveWorkbook.Save
'https://stackoverflow.com/questions/18899824/how-to-use-vba-saveas-without-closing-calling-workbook
'SaveAsCopy
Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet
On Error GoTo Whoa
Application.DisplayAlerts = False
Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add
On Error Resume Next
For Each ws In wbTemp.Worksheets
ws.Delete
Next
On Error GoTo 0
For Each ws In thisWb.Sheets
ws.Copy After:=wbTemp.Sheets(1)
Next
wbTemp.Sheets(1).Delete
'wbTemp.SaveAs "C:\Users\Me\Desktop\FileName & Format(CStr(Now), dd-mm-yy-hhumm).xlsm", 52 'Save as timestamp
wbTemp.SaveAs ("C:\Users\Me\Desktop\") & "FileName" & Format(Now, "dd-mm-yy-hhumm") & ".xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
LetsContinue:
Application.DisplayAlerts = True
Exit Sub
Whoa:
MsgBox Err.Description
Resume LetsContinue
End Sub