f



How do you hide a Worksheet in Excel using Matlab?

In Matlab, I am creating an Excel File with multiple worksheets in
it. However, I would like to hide one of those worksheets so that it
is not visible to the user after I save it. I do not want to delete
the worksheet because I need that worksheet to run some Macros in it.
 How can I do this?

Thanks for your time,

 Brad
0
1/5/2005 6:51:45 PM
comp.soft-sys.matlab 211266 articles. 16 followers. lunamoonmoon (258) is leader. Post Follow

4 Replies
828 Views

Similar Articles

[PageSpeed] 16

Brad G. wrote:
>
>
> In Matlab, I am creating an Excel File with multiple worksheets in
> it. However, I would like to hide one of those worksheets so that
> it
> is not visible to the user after I save it. I do not want to
> delete
> the worksheet because I need that worksheet to run some Macros in
> it.
> How can I do this?
>
> Thanks for your time,
>
> Brad

% OPEN EXCEL
Excel=actxserver('Excel.Application');
Excel.Visible=1;
% OPEN WORKBOOK and SHEET
Workbooks=Excel.Workbooks;
Workbook=invoke(Workbooks,'Add');
Activesheet=Excel.Activesheet;
Activesheet.Visible = 0;
0
1/5/2005 7:08:41 PM
Hi,

Could you please explain it clearly. As I have a excel file with multiple sheets. I want to hide one or more sheets.
Please help me out.
Thank you.



"Michael Robbins" <michael.robbins@us.cibc.com> wrote in message <eef7b29.0@webx.raydaftYaTP>...
> Brad G. wrote:
> >
> >
> > In Matlab, I am creating an Excel File with multiple worksheets in
> > it. However, I would like to hide one of those worksheets so that
> > it
> > is not visible to the user after I save it. I do not want to
> > delete
> > the worksheet because I need that worksheet to run some Macros in
> > it.
> > How can I do this?
> >
> > Thanks for your time,
> >
> > Brad
> 
> % OPEN EXCEL
> Excel=actxserver('Excel.Application');
> Excel.Visible=1;
> % OPEN WORKBOOK and SHEET
> Workbooks=Excel.Workbooks;
> Workbook=invoke(Workbooks,'Add');
> Activesheet=Excel.Activesheet;
> Activesheet.Visible = 0;
0
Suraj
2/19/2015 12:25:59 PM

"Suraj Srivastava" <suraj.srivastava@smartanalyst.com> wrote in message 
news:mc4kon$j9b$1@newscl01ah.mathworks.com...
> Hi,
>
> Could you please explain it clearly. As I have a excel file with multiple 
> sheets. I want to hide one or more sheets.
> Please help me out.
> Thank you.

Considering that the message to which you're replying is ten years old and 
Michael hasn't posted to CSSM in quite a while, he's unlikely to respond.

I don't know off the top of my head the command to hide a worksheet using 
Microsoft Excel's COM interface; take a look at the METHODS for the 
Activesheet object created by the commands Michael posted and one of them 
may be what you need. If not, you should ask Microsoft support (or search 
microsoft.com) the COM interface command to use to hide a worksheet.

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
Steven
2/19/2015 2:57:02 PM
"Suraj Srivastava" wrote in message <mc4kon$j9b$1@newscl01ah.mathworks.com>...
> Hi,
> 
> Could you please explain it clearly. As I have a excel file with multiple sheets. I want to hide one or more sheets.
> Please help me out.
> Thank you.
> 
> 
> 
> "Michael Robbins" <michael.robbins@us.cibc.com> wrote in message <eef7b29.0@webx.raydaftYaTP>...
> > Brad G. wrote:
> > >
> > >
> > > In Matlab, I am creating an Excel File with multiple worksheets in
> > > it. However, I would like to hide one of those worksheets so that
> > > it
> > > is not visible to the user after I save it. I do not want to
> > > delete
> > > the worksheet because I need that worksheet to run some Macros in
> > > it.
> > > How can I do this?
> > >
> > > Thanks for your time,
> > >
> > > Brad
> > 
> > % OPEN EXCEL
> > Excel=actxserver('Excel.Application');
> > Excel.Visible=1;
> > % OPEN WORKBOOK and SHEET
> > Workbooks=Excel.Workbooks;
> > Workbook=invoke(Workbooks,'Add');
> > Activesheet=Excel.Activesheet;
> > Activesheet.Visible = 0;

To hide a worksheet called "Sheet2":
Workbook.Worksheets.Item('Sheet2').Visible = false;

(get the Workbook reference handle as described above)

Yair Altman 
http://UndocumentedMatlab.com 
 
0
Yair
2/19/2015 3:12:59 PM
Reply: