View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Hide/Show column at run-time

This last one ( ((Excel.Range)(oSheet.Cells[1, col])).EntireColumn.Hidden =
true; )
should have worked.
- You are sure that
((Excel.Range)(oSheet.Cells[1, col]))
is pointing to the right book, sheet, range?
- And can you check the value of
((Excel.Range)(oSheet.Cells[1, col])).EntireColumn.Hidden
just after you set it to true ?

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"VenuV" wrote:

I thought this would work, but the columns are still visible in my output file.

((Excel.Range)(oSheet.Cells[1, col])).EntireColumn.Hidden = true;


"VenuV" wrote:

I am writing a CSharp program that creates an excel file. Now, I want to
hide/show certain columns after the excel file has been created. I am using
the Application object model and worksheet object. My Vstudio doesn't give me
any options to access the column hide/show features and in fact. I tried
various ways including this, which won't work.

((Excel.Range)(oSheet.Columns[0,col])).EntireColumn.Hidden = true;

Please advise.
Thanks,