I have a VSTO workbook which has been developed over the last few years, there is a lot of code in it.
We are migrating this to a cloud based solution.
I want to develop some automated testing to ensure the results from the cloud solution match the existing VSTO workbook.
My approach was to do this.
1. Add a new VSTO workbook to the same solution in a 2nd project
2. Have this 2nd excel file open the main project, change some variables, call a number of modules in that file and then compare against the cloud results.
3. Store the results in the 2nd project of each test, and then close main file.
4. Repeat hundreds of times.
The issue I have is that when I execute a Function like this from within the Main project I get no issues:
Public Shared Function MyWorkbookName() As String
Dim s_Result As String
s_Result = Globals.ThisWorkbook.FullName
Return s_Result
End Function
When I call a function like this from the 2nd project though (the function sits in the Main project, but the 2nd file tries to access its result)
I get this error:
System.NullReferenceException: 'Object reference not set to an instance of an object'

I would appreciate any guidance or alternative approaches to what i'm trying to do.