From: Danny on
> How do I specify the argument "After" that says after which sheet I have to copy? there is here probably some special syntax that I am missing.
>
> Any help will be very appreciated!
> Best regards
> Claudio

First off, I have found this thread very helpful, thank you!

I also wanted to try to copy a sheet after the active sheet, but I could not find the right syntax for the copy command either. Instead I found a solution which let me re-order the sheets afterwards. Maybe this will be helpful to you too:

excel = actxserver('excel.application');
ExcelFile = 'filename';
%open the excel file
wkbk = excel.Workbooks.Open(ExcelFile); %This file has a sheet named "1" which has some formating

wksheet = wkbk.Worksheets.Item('1'); % Choose desired sheet

for n = 2:5
%make a copy of the template sheet
wksheet.Copy(wksheet); %this will create a sheet called "1 (2)" and places it before "1"
newSheet=wkbk.Worksheets.Item('1 (2)'); %get a handle to this copied sheet
newSheet.Name=num2str(n); %rename it with a new name
end

%In Excel this results in five sheets, in order named: 2 3 4 5 1, but I want the order: 1 2 3 4 5

% Get the list of sheets in the workbook
Sheets = wkbk.Sheets;
% Moves Sheet "1" to before sheet "2"
Sheets.Item('1').Move(Sheets.Item('2'))

Best Regards,
Danny Sale
From: Richard de Garis on
This is very useful stuff; I had no idea this sort of thing was possible. But it gets me to thinking, is there a book anyone can recommend that presents a reasonably simple, but comprehensive guide to what can be achieved?

I don't particularly want to become a VB expert, but if there's an easily understandable reference that I can dip into as a MATLAB programmer looking to do something a bit clever with Excel, then please let me know.

Thank you to all those who posted these very helpful examples!