views:

112

answers:

1

Hi, 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.

+2  A: 

This appears to be "By Design". The documentation for GetVStoObject states it will return Nothing in the case that the excel worksheet is a not a Visual Studio Tools For Office Excel Worksheet

You're going to need to create an explicit Excel Worksheet Project in order to have this method return meaningful data .

JaredPar
agreed with Jared, this is by design.
Otaku
This sucks, because I'm not allowed to do that. Guess I'll have to but up with the buggy Interop then.
Bloodsplatter