K
kazzy
Hi VBAers,
In the code below, I am getting an error on the following line:
ElseIf ireply = vbNo And ActiveWorkbook = filename Then
Sub FN_CreateDOHVSRBatch()
Dim filename As String
Dim ireply As Integer
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
filename = Worksheets("Amtreference").Range("A2").Text
Batchprompt:
ireply = MsgBox(Prompt:="Do you wish to create a new batch?", _
Buttons:=vbYesNo, Title:="Create New Service Request
Batch")
If ireply = vbYes Then
ActiveWorkbook.SaveAs filename:=filename & Format(Date,
"yyyymmdd ") _
& Format(Time, "hh.mm") & ".xls"
ElseIf ireply = vbNo And ActiveWorkbook = filename Then
MsgBox "You cannot input data into the actual DOHV Service
Request Template. Please respond 'Yes' to create new batch."
GoTo Batchprompt
ElseIf ireply = vbNo And ActiveWorkbook <> filename Then
Exit Sub
End If
End Sub
Obviously I cannot put "and activeworkbook = filename then with the
'if' statement" but i have no idea how else to code this.
Can anyone please help?
In the code below, I am getting an error on the following line:
ElseIf ireply = vbNo And ActiveWorkbook = filename Then
Sub FN_CreateDOHVSRBatch()
Dim filename As String
Dim ireply As Integer
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
filename = Worksheets("Amtreference").Range("A2").Text
Batchprompt:
ireply = MsgBox(Prompt:="Do you wish to create a new batch?", _
Buttons:=vbYesNo, Title:="Create New Service Request
Batch")
If ireply = vbYes Then
ActiveWorkbook.SaveAs filename:=filename & Format(Date,
"yyyymmdd ") _
& Format(Time, "hh.mm") & ".xls"
ElseIf ireply = vbNo And ActiveWorkbook = filename Then
MsgBox "You cannot input data into the actual DOHV Service
Request Template. Please respond 'Yes' to create new batch."
GoTo Batchprompt
ElseIf ireply = vbNo And ActiveWorkbook <> filename Then
Exit Sub
End If
End Sub
Obviously I cannot put "and activeworkbook = filename then with the
'if' statement" but i have no idea how else to code this.
Can anyone please help?