calico-cat calico-cat - 1 month ago 7
Vb.net Question

I'm getting the error "Application" is ambiguous in the namespace 'microsoft.office.interop.excel'

I have a project which opens a simple Excel file and populates it. It was working fine until this morning, when it has suddenly started giving me the error above:

'Application' is ambiguous in the namespace 'Microsoft.Office.Interop.Excel'
.

I haven't changed any project references, or anything within the file itself. The references include Microsoft.Office.Interop.Excel. The imports statement is there:
imports Microsoft.Office.Interop


The object declaration is also complete:
Dim xl As Microsoft.Office.Interop.Excel.Application
which is the line that's giving me the error!

I've tried googling this error, and the only response is that I need to declare
xl
as
Microsoft.Office.Interop.Excel.Application
.

The fact that I hadn't changed anything within the project nor the code tells me this is a corruption in Visual Studio 2008. However, cleaning and rebuilding the project, rebooting Windows, and restarting VS has no effect.

Any ideas?

Answer

Removing and re-adding the reference solved this issue. (David hasn't come back to allow me to mark his as the answer!)