as a workaround for the Locale bug in Office Interop I wanted to use VSTO but if I call
app.ActiveWorkbook.GetVstoObject()
then it returns nothing. I’m working from a .NET 2.0 Visual Basic Application project. This is not an add in or a special VSTO project. I have added the required Imports and References.
Dim app As New Excel.Application
app.Caption = "Rapport"
app.Visible = True
app.Workbooks.Add()
Dim tmp As Object = app.ActiveWorkbook.VBProject
Dim book As Workbook = app.ActiveWorkbook.GetVstoObject() 'Returns Nothing
This is a school project and it needs to be finished by the end of next week so any fast help is very much appreciated.
This appears to be “By Design”. The documentation for GetVStoObject states it will return
Nothingin the case that the excel worksheet is a not a Visual Studio Tools For Office Excel WorksheetYou’re going to need to create an explicit Excel Worksheet Project in order to have this method return meaningful data .