I have a Excel Object named ThisWorkbook and a Module named Module1. In Module1, I have a function called function1. ThisWorkbook has a private sub called sub1. When user call this function, I want Excel to do sub1 first and if it has no error, perform the rest of the function. However, I am unable to process sub1 when call function1.
Excel Object - ThisWorkbook
Private WithEvents App As Application
Public Sub sub1(some parameters)
...
If (condition) Then
Msgbox ()
End If
...
End Sub
Private Sub Workbook_Open()
Set App = Application
End Sub
Excel Module - Module1
Function function1(Add As String, some parameters) As String
ThisWorkbook.sub1(some parameters)
...
End Function
** updated frequently to show the current state of code