F
freshforlife
Hi All,
I have defined a subroutine in the ThisWorkbook class as:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
--- code
--- code
End Sub
Now I have another subroutine in Module 1 of my workbook:
Sub Userform()
-- Code
-- Code
If Err = 0
Then Call Workbook_BeforeClose(True)
Exit Sub
End If
End Sub
Now I want to call the subroutine Workbook_BeforeClose from within the
Userform() routine, if there is an Error is encountered -- basically i
want to close the entire workbook.
Can somebody shed light on how to achieve this ?
Thanks,
Ravi
I have defined a subroutine in the ThisWorkbook class as:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
--- code
--- code
End Sub
Now I have another subroutine in Module 1 of my workbook:
Sub Userform()
-- Code
-- Code
If Err = 0
Then Call Workbook_BeforeClose(True)
Exit Sub
End If
End Sub
Now I want to call the subroutine Workbook_BeforeClose from within the
Userform() routine, if there is an Error is encountered -- basically i
want to close the entire workbook.
Can somebody shed light on how to achieve this ?
Thanks,
Ravi