In the header I want the filter to appear once the document has been created in excel.
I have tried several options and combinations, but NO have worked for me.
Option 1:
oRng = oSheet.get_Range("A1", "J1");
oRng.AutoFilter("1", "<>", Microsoft.Office.Interop.Excel.XlAutoFilterOperator.xlOr, "", true);
Option 2:
oSheet.Application.ActiveWindow.SplitRow = 1;
oSheet.Application.ActiveWindow.FreezePanes = true;
oRng = (Microsoft.Office.Interop.Excel.Range)oSheet.Rows[1];
oRng.AutoFilter(1, Type.Missing, Microsoft.Office.Interop.Excel.XlAutoFilterOperator.xlAnd, Type.Missing, true);
The errors that they give me are the following:
1- "The operation could not be completed for the range of cells selected. Select a single cell within the range and try it again. "
2- "Error in the AutoFilter method of the Range class."