Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Hide/Show column at run-time

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,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Hide/Show column at run-time

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,

  #3   Report Post  
Posted to microsoft.public.excel.programming
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,

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Hide/Show column at run-time

I checked the value it gives an exception when I try to find the value

<error: an exception of type: {System.ArgumentException} occurred

Maybe it is looking for an assignment.



"sebastienm" wrote:

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,

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

Sorry, but i am running out of idea.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"VenuV" wrote:

I checked the value it gives an exception when I try to find the value

<error: an exception of type: {System.ArgumentException} occurred

Maybe it is looking for an assignment.



"sebastienm" wrote:

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,



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Hide/Show column at run-time

Hi,
I don't know CSharp, but the syntax of the COlumns seems weird:
can you do something like:
Columns[col]
or
Columns[ ,col]
or
Columns[ <missing ,col]

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


"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,

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Hide/Show column at run-time


I tried Columns[1, col] and it gives me a numbered exception -

Exception from HRESULT: 0x800A03EC

The other options you suggested give syntax errors.

"sebastienm" wrote:

Hi,
I don't know CSharp, but the syntax of the COlumns seems weird:
can you do something like:
Columns[col]
or
Columns[ ,col]
or
Columns[ <missing ,col]

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


"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,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I conditionally hide or show a column in Excel HarrisonR Excel Discussion (Misc queries) 2 July 18th 07 09:08 PM
Hide column and show only in row in use Kylie Rose Excel Discussion (Misc queries) 1 January 19th 06 11:22 AM
Show/Hide Column and Row Headers graz Excel Discussion (Misc queries) 2 September 29th 05 01:37 AM
hide column but show chart Svetlana Charts and Charting in Excel 1 January 14th 05 09:49 AM
Macro for Show/Hide Column Andy Excel Discussion (Misc queries) 2 November 26th 04 01:03 PM


All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"