I am using office 2007 excel work sheet function in c# code.
VS2010 issues this warning
Warning 3 Ambiguity between method
‘Microsoft.Office.Interop.Excel._Worksheet.Activate()’
and non-method
‘Microsoft.Office.Interop.Excel.DocEvents_Event.Activate’.
Using method
group. D:\EXLANEDB01p\dev\libraries\EXCEL\Excel.cs 531 95 EXCEL
How do I resolve this ?
the call is
xSheet.Activate();
where xSheet passed as ref in the call as
ref Microsoft.Office.Interop.Excel.Worksheet xSheet
You need to disambiguate the
Activatename. Within the Worksheet interface,Activateis either a method (if looked at as a_Worksheetobject) or an event (if looked at as aDocEvents_Eventobject).Cast your object to
Microsoft.Office.Interop.Excel._Worksheetfirst then callActivate().Or declare a new
_Worksheetvariable and use that within your method.Otherwise you could change your method declaration to take a reference to a
_Worksheetinstead of aWorksheetas well as all associated declarations.