This is where the error is...(if you need to see more code let me know)
if (employeeID == "134")
{
oXL.Sheets[new string[2] { "134", "134_ManagerComments" }].Copy();
and the compiler is highlighting the [new string[2]] and telling me on new:
Identifier expected; 'new'is a keyword and on string
Expected class, delegate, enum, interface, or struct
How should this be ammended in order to remove these errors?
Loading
VulpesPosted Feb 13, 2013, 11:10 AM
What that error suggests to me is that there's a problem with your curly braces in code earlier in the file with the result that this method doesn't appear to the compiler to be part of a class.
So, I'd re-examine the code in the light of that.
VulpesPosted Feb 13, 2013, 11:35 AM
The following is a real killer in a console app which has caused some head-scratching in its time:
The code builds OK but produces the following exception:
richard smithPosted Feb 13, 2013, 11:17 AM
richard smithPosted Feb 13, 2013, 10:22 AM
public static void copySheets()
{
Excel.Application oXL;
if (employeeID == "134")
{
oXL.Sheets[new string[2] { "134", "134_ManagerComments" }].Copy();
}
VulpesPosted Feb 13, 2013, 10:00 AM
I'd see if it makes any difference if you split it up like this: