Yes the posted code is in the Userform module.
Here is the code when the userform is called
Public Function getMortgage(uwWorkbook As Excel.Workbook, bSilent As Boolean, pwdExcelProtection As String, Optional ByRef bHadErrors As Boolean) As Boolean
Dim myObj As Object
Dim blnResult As Boolean
Dim foundCOOP As Boolean, foundSrHsng As Boolean, foundSrApts As Boolean
Dim foundCommData As Boolean
Dim wsSummary As Excel.Worksheet
Dim foundPreCombData As Boolean
Dim foundFinCombData As Boolean
'Dim wb As Excel.Workbook
'Dim wsIE As Excel.Worksheet
Dim uid As String, pwd As String
Dim strLoanStatus As String
'Declare all parameter arrays for calling the web service
Dim arIE_Types() As String
Dim arFinlStmt_Data() As Variant
Dim arLoanInfo() As String
Dim arIE_Data() As Variant
Dim arRR_Data() As Variant
Dim arLA_Data() As Variant
Dim arDebtSvc_Data() As Variant
Dim arWebService_Data() As String
Dim arRR_Column() As Integer
Dim arPage() As String
Dim arChildrenToGet(0 To 0) As String
Dim strLoanNumber As String
Dim i As Integer, j As Integer
Dim ws As Excel.Worksheet
Dim iStatement As Integer
Dim strTabCode As String
Dim wsRR As Excel.Worksheet
Dim wsLA As Excel.Worksheet
Dim c As Integer
Dim r As Integer
'Dim rTop As Integer
Dim Cell As Excel.Range
Dim rng As Excel.Range
Dim rngBaseYear As Excel.Range
Dim rRR As Integer
Dim rLA As Integer
Dim strErrors As String
Dim intIE_Data_Col_Line_Item_Name As Integer
Dim intIE_Data_Col_Error_Info As Integer
Dim intIE_Data_Col_Amount As Integer
Dim intIE_Data_Col_Description As Integer
Dim intIE_Data_Col_Cashflow_Year As Integer
Dim intLA_Data_Col_Error_Info As Integer
Dim intLA_Data_Col_LA_Info As Integer
Dim intRR_Data_Col_Error_Info As Integer
Dim intRR_Data_Col_Detail_Summary_Ind As Integer
Dim currentLoanChartc As String
Dim currentLoanChartcDesc As String
Dim Version As String
'Commercial Variables
Dim strCommercial As String
'Initialize HadErrors return flag
bHadErrors = True
'First check if the calling workbook is based on a template that is supported by this Addin version
'If the template version of the caller workbook is not supported by the Addin, Notify user with an Error message and exit
On Error Resume Next
Version = uwWorkbook.Names(NAME_UW_WORKBOOK_VERSION_CELL).RefersToRange.value
If Not (Err.Number = 0) Then Version = ""
On Error GoTo ErrHandler
If Not CheckTemplateVersion(Version) Then
MsgBox ERR_MSG_UNSUPPORTED_TEMPLATE_VERSION, vbOKOnly + vbExclamation
getMortgage = True 'Since we already displayed an error message to the user, return true
Exit Function
End If
' Get the loan number from the loan info sheet
strLoanNumber = uwWorkbook.Names(NAME_LOAN_INFO).RefersToRange.Worksheet.Names(NAME_LOAN_NUMBER).RefersToRange.value
If (strLoanNumber = "") Or (strLoanNumber = "000") Then
ShowErrorForm ERR_MSG_INVALID_LOAN_NUM
getMortgage = True 'Since we already displayed an error message to the user, return true
Exit Function
End If
' ------------------------------------------
' Invoke the web service to refresh data
' ------------------------------------------
' Call into the web service to the get the loan/mortgage data
On Error Resume Next
'Set myObj = New FM_IE_ExcelXMLMap.ExcelXMLMap 'EARLY BINDING ONLY FOR TESTING; IN PRODUCTION, ALWAYS USE LATE BINDING
Set myObj = CreateObject("FM_IE_ExcelXMLMap.ExcelXMLMap")
If (Err.Number = 0) Then
arChildrenToGet(0) = "EVERYTHING" 'Constant string indicating that we want to get all children of the mortgage dataset
'ReDim all parameter arrays before calling; there are out parameters in the function signature
ReDim arIE_Types(0 To 1)
ReDim arFinlStmt_Data(0 To 1)
ReDim arLoanInfo(0 To 1, 0 To 1)
ReDim arIE_Data(0 To 1)
ReDim arRR_Data(0 To 1)
ReDim arLA_Data(0 To 1)
ReDim arDebtSvc_Data(0 To 1)
'ReDim arWebService_Data(0 To 1)
'User gets three tries according to the standard norm for number of retries allowed for authentication
Dim bAuthSuccess As Boolean
bAuthSuccess = True
LoadUrl arWebService_Data()
For i = 1 To 3
' ------------------------------------------
' Retrieve user credentials before calling into the web service
' ------------------------------------------
UpdateStatusBar ("Authenticating with MFU web service...")
uid = ""
pwd = ""
If (uidpwd(uid, pwd) = True) Then 'try to retrieve cached credentials of user
If (uid = "") Then 'there are no cached credentials; this is the first time user is hitting the web service
Application.Cursor = xlDefault 'Restore the mouse cursor
Load frmMFULogin
If Not (bAuthSuccess) Then
frmMFULogin.SetErrorMsg ("LOGIN_DENIED")
End If
frmMFULogin.Show vbModal
'Check if user canceled the operation by clicking cancel on the form
If (frmMFULogin.txtUsername = "") Then
Unload frmMFULogin
Call UpdateStatusBar("", True)
getMortgage = True
Exit Function
Else
uid = frmMFULogin.txtUsername
pwd = frmMFULogin.txtPassword
End If
End If
Else
Exit For
End If
'Call web service method with user credentials
Err.Clear
'Make the call
UpdateStatusBar ("Calling web service to refresh data...")
'Show hourglass cursor to user indicating that the authentication process is not complete yet!
Application.Cursor = xlWait