8
Answers

Run C# Array in Excel

richard smith

richard smith

11y
2k
1
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)