Hi unknown,
The problems I'm having a
1) I am getting the message and prompt "Have you entered
correct LoginName?"
twice
2) Something is wrong with this part of the code:
ActiveWorkbook.SaveAs
Sheets("Jan").Range("Y23").Value & ".xls"
try
ActiveWorkbook.Save FileName:= Range("Y23").Value & ".xls"
instead of that.
3) When the Excel Prompt comes with "File already exists
do you want to
replace it" and the user clicks no another prompt
says "visual basic error
400"
with the save command you shouldn't have the problems with
replacing.
Best
Markus
Please help and provide detailed answer as I am new with
VB.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As
Boolean, Cancel As Boolean)
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
If Me.Sheets(1).Range("$T$23").Value = "" Then
Beep
MsgBox "You have not entered your LoginName on
the first sheet - Jan!"
Let Cancel = True
Exit Sub
End If
Msg = "Have you entered correct LoginName?"
Style = vbYesNo
Title = "Save Prompt"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
ActiveWorkbook.SaveAs Sheets("Jan").Range
("Y23").Value & ".xls"
Exit Sub
Else
Cancel = True
End If
End Sub
.