Prev: USAF datcom import help
Next: Mex file crashes Matlab
From: Marco Santos on 28 Jul 2010 12:47 Hello, I'm trying to duplicate a sheet in an Excel Workbook and to copy a designated sheet of a Workbook to another designated Workbook. In alternative duplicate a designated sheet in the same workbook. Sheet1 of Workbook1 duplicated in Workbook2 or Sheet1 of Workbook1 duplicated in Workbook1 Thanks.
From: Andy on 28 Jul 2010 13:06 "Marco Santos" <mfcsantos(a)refer.pt> wrote in message <i2pmu8$em$1(a)fred.mathworks.com>... > Hello, > > I'm trying to duplicate a sheet in an Excel Workbook and to copy a designated sheet of a Workbook to another designated Workbook. In alternative duplicate a designated sheet in the same workbook. > > Sheet1 of Workbook1 duplicated in Workbook2 > or > Sheet1 of Workbook1 duplicated in Workbook1 > > Thanks. Is there a particular reason you want to use actxserver for this? xlswrite and xlsread should be enough.
From: Marco Santos on 29 Jul 2010 04:11 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i2po1u$edc$1(a)fred.mathworks.com>... > "Marco Santos" <mfcsantos(a)refer.pt> wrote in message <i2pmu8$em$1(a)fred.mathworks.com>... > > Hello, > > > > I'm trying to duplicate a sheet in an Excel Workbook and to copy a designated sheet of a Workbook to another designated Workbook. In alternative duplicate a designated sheet in the same workbook. > > > > Sheet1 of Workbook1 duplicated in Workbook2 > > or > > Sheet1 of Workbook1 duplicated in Workbook1 > > > > Thanks. > > Is there a particular reason you want to use actxserver for this? xlswrite and xlsread should be enough. Hello, I have a template that I wish to fill in with the output of my application. This template is a Sheet of, for example, Workbook1. I need to duplicate it several times to, for example, Workbook2. The end result will be a bunch of sheets in Workbook2 that are like the template with the required information that results from the aplication filled in. I've tried to add a new Sheet and copy/paste the content of the template sheet to this new sheet. It works almost fine, the only problem is that not all the characteristics of the template sheet are reproduced in the new sheet.
From: Andy on 29 Jul 2010 08:41 > I've tried to add a new Sheet and copy/paste the content of the template sheet to this new sheet. It works almost fine, the only problem is that not all the characteristics of the template sheet are reproduced in the new sheet. Well, what exactly did you try (post the code, not a description), and what exactly went wrong (post the error message, or say precisely what characteristic did not get copied)?
From: Marco Santos on 29 Jul 2010 11:18 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i2rsth$ja0$1(a)fred.mathworks.com>... > > I've tried to add a new Sheet and copy/paste the content of the template sheet to this new sheet. It works almost fine, the only problem is that not all the characteristics of the template sheet are reproduced in the new sheet. > > Well, what exactly did you try (post the code, not a description), and what exactly went wrong (post the error message, or say precisely what characteristic did not get copied)? The content of the template sheet was copied precisely. The print margins weren't copied. I've found some code lines in a previous thread that doesn't do quite what I want: (http://www.mathworks.de/matlabcentral/newsreader/view_thread/23896) I've made some new tests and finaly found out how to duplicate repeatedly a template sheet to a new workbook: Excel=actxserver('Excel.Application'); Excel.Visible = -1; WB=invoke(Excel.Workbooks,'open','d:\template.xlsx'); SHS=WB.Sheets; %sheets of template Workbook SH=Excel.ActiveSheet; %active sheet of template Workbook % The following makes a copy of the sheet, but to a new Workbook. invoke(SH,'Copy') nWB=Excel.ActiveWorkbook; %new Workbook SH=Excel.ActiveSheet; %active sheet of new Workbook nDup=10; %assuming I need to make 10 duplications of the same template sheet to the new workbook for n=1:nDup-1 %the first sheet was already duplicated with the creation of the new Workbook % The following makes a copy of all sheets (in this case only one sheet of the template) to the current Workbook (new Workbook) invoke(SHS,'Copy',SH); end bye
|
Pages: 1 Prev: USAF datcom import help Next: Mex file crashes Matlab |