richard smith

richard smith

  • 1.5k
  • 285
  • 160.3k

Run C# Array in Excel

Feb 7 2013 11:29 AM
I have a C# array set-up like this:
Prefix = new string[2] { "Alpha", "Omega" };
fName = new string[2] { "123", "481" };

for (int i = 0; 0 < Prefix.Length; i++)
{
for (int x = 0; 0 < fName.Length; x++;
{
xlApp.GetType().InvokeMember("Run", System.Reflection.BindingFlags.Default | System.Reflection.BindingFlags.InvokeMethod, null, xlApp, new object[], { "MacroName", Prefix, fName }
}
}

The problem I have is that Excel continues to cycle the elements in the array, and does not terminate the array once all elements have been processed.  Is this a C# issue, or an issue in my Excel Macro?

Answers (8)