I'm loading a workbook from an excel add in with something like...
Excel.Loadworkbook thenameof = this.Application.Runtime, missing, missing,missing etc...
Anyway, my question is in this example what is "thenameof" called, is it a variable, object what?
And more importantly how do I have that name change inside of a loop. I need that line to run 15 times with just thenameof part changing so:
for( i = 1; 1 <=15 i++)
excel.Loadworkook thenameof_i = this.Application.Runtime, missing, missing, missing etc...
How do I append that, I've tried a bunch of things and it always results in errors.
I'm lost stupid help needed again.
Started by williamevanl, Mar 24 2010 04:47 AM
3 replies to this topic
#1
Posted 24 March 2010 - 04:47 AM
|
|
|
#2
Posted 24 March 2010 - 04:41 PM
From what I understand, you want to import multiple workbooks, right?
Then I would suggest that you make an array of workbooks. I have never tried to load a workbook, so I can´t promise that it will work and I can´t tell you how to do it. But to change the name of an array in a loop is quite easy:
for(int i = 0; i<15; i++)
thenameof[i] = this.Application.Runtime, missing, missing, missing etc...
Sorry if I didn´t understand you;)
Then I would suggest that you make an array of workbooks. I have never tried to load a workbook, so I can´t promise that it will work and I can´t tell you how to do it. But to change the name of an array in a loop is quite easy:
for(int i = 0; i<15; i++)
thenameof[i] = this.Application.Runtime, missing, missing, missing etc...
Sorry if I didn´t understand you;)
#3
Posted 25 March 2010 - 04:56 AM
The problem I run into is that I can't place "thenameof[i] = this.Application.Runtime, missing, missing, missing etc..."
in front of
Excel.Loadworkbook
without causing an error.
in front of
Excel.Loadworkbook
without causing an error.
#4
Posted 25 March 2010 - 07:21 AM
Loading and reading the Microsoft Excel file contents using C# - CodeProject
This article seems to tell you how to load a workbook properly!
This article seems to tell you how to load a workbook properly!


Sign In
Create Account


Back to top









