Hi Guys,
At wok ad we just upgraded to Office 365, the code below worked great before upgrade, but now I get a compile error to find the project or library on the word "Format" on the "sname" line.
It basically formats the date (A4) in a cell copies it and merges it with AM or PM from B4 2 on the right. Then saves as this new title. I just can't put my finger on it, even after searching the excel help on object browser.
Sorry about the code formatting, work restrictions for downloads.
Thanks in advance.
At wok ad we just upgraded to Office 365, the code below worked great before upgrade, but now I get a compile error to find the project or library on the word "Format" on the "sname" line.
It basically formats the date (A4) in a cell copies it and merges it with AM or PM from B4 2 on the right. Then saves as this new title. I just can't put my finger on it, even after searching the excel help on object browser.
Sorry about the code formatting, work restrictions for downloads.
Code:
Private Sub CommandButton3_Click()
Dim relativePath As String, sname As String
Dim Msg As String, Ans As Variant
On Error GoTo ErrorHandlerA:
Msg = "Are you sure you want to save this Changeover as another sheet?"
Ans = MsgBox(Msg, vbYesNo)
Select Case Ans
Case vbYes
sname = Format(Range("A4").Value, "dd.mm.yyyy") & " " & Right(Range("B4").Value, 2) & ".xlsm"
relativePath = Application.ActiveWorkbook.Path & "" & sname
ActiveWorkbook.SaveAs Filename:=relativePath
Case vbNo
GoTo Quit:
End Select
Quit:
ErrorHandlerA:
Exit Sub
End Sub
Thanks in advance.
Last edited by a moderator: