Reading Multiple Excel Files and Execute Macro

excel

#1

Hi,

I have 4 excel files I need to read, then invoke a macro which will do some stuff and generate 3 CSV files.

Can I use the Excel application scope activity for this? If so, how would I use it to read the 4 excel files. Or do I need to kick of the excel application, open the files and do it that way?

Thanks

Martin


#2

Hi,

If you want to read the data you would have to use “Read Range” activity. If you search for “Read Range” in activities, you will get 2 matching activities. If you use this activity from System Collection (not from Excel activities) you would not need to use excel application scope.

Using Read range activity, you can get the data in datatable which you can process and export in csv.

~Rupesh


#3

Hi,

Thanks for the response.

Let me be clearer. Once the excel files are open . There is one macro I need to run. This macro will then extract some data. It is the macro that will then create the CSV files.

I am using the Excel application scope activity, but I do not know if would keep all 4 open or just the last one. When it gets to the point of invoking the macro it says the macro does not exist.

Thanks

Martin


#4

It is recommended that you should close the files which are not in use. So open and close the excel sheets on by one. And Run the macros within the application scope. Maybe in your case it is searching for the macro in wrong file.


#5

I had to nest the Excel Application Scope activities and then run the Macro appeared to work.