LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default fails tospecify max Columns size in 2007, InteropServices.COMExcep

hello , does any one have this problem?

In Excel , the exception throw above
system.Runtime.InteropServices.COMException (0x80020005): Type mismatch. see
http://forums.microsoft.com/MSDN/Sho...98970&SiteID=1
this threat have been took care for office 2003 system.
it is adolutely working fine with using namedRange.inner object in office
2003.. but it have been a issue in office 2007 system.
see this code above , there is adsulotely work fine for office 2003. but not
office 2k7


:
when we migrating a previous Excel xls project 2003 to office 2007, OS XP,
using Vsto 2005 SE , use by C#, we change out some of line of code in
the template's com library cs, for comptible to office 2007 system ,
as such Office 2007 ha,ve change column cell maximun limited to 256(IV) to
160000
in the scope of ClearALL this method is to clealr of the all data the have
in the column/cell in the sheet.:
it is fails to specific the sheet. column object with column's max size
-- in sheet .Column range from (AA:ZZ) to (A:IV) ( note column speficfiy
in 2003 are fine column(aa:zz)

it is exeatly a problem with column 's maximun size to be specify in the
code. if
you put in 'column(aa:ZZ) in office 2007 , it have 'an invilated range'
error throw.




cAll= (Excel.Range)this.Sheet.Columns[ "A:IV", Type.Missing ];


b/c office 2007 is change sheet .columns maximun volumn specifiyed to IV.
then the column cell is not creating in design time of the project runing ,
there is a exception throw :


system.Runtime.InteropServices.COMException (0x80020005): Type mismatch.
we not yet know how to ..
have any one got that ? any suggetion? you help are highly appreciated.


Chan


thanks pinky

code exmaple:
/// Set individual cell in a workspace into the value


/// </summary


void SetValue( int r, int c, string s, bool bBold )


{


if( s!= "" )


((Excel.Range)this.Sheet.Cells[r, c ]).FormulaR1C1=
s;


((Excel.Range)this.Sheet.Cells[r, c ]).Font.Bold= bBold;


}


/// <summary


/// Set individual cell in a workspace into the value


/// </summary


string GetValue( int r, int c )


{


return ((Excel.Range)this.Sheet.Cells[r, c
]).Value2.ToString();


}


/// <summary


/// Assign a range with the bold


/// </summary


void SetBold( int r, int r1, bool b )


{


((Excel.Range)this.Sheet.get_Range( this.Sheet.Cells[r,1],
this.Sheet.Cells[r1+1,1] )).Font.Bold= b;


-------------------
void ClearAll()


{


int i= YOFFS;


Excel.Range cAll= (Excel.Range)this.Sheet.Rows[
i.ToString()+ ":65535", Type.Missing ];


try


{


cAll.Rows.Ungroup();


cAll.Rows.Ungroup();


cAll.Rows.Ungroup();


}


catch


{ }


cAll.ClearContents();


cAll.Interior.ColorIndex=
Excel.XlColorIndex.xlColorIndexNone;


cAll.Font.Bold= false;


cAll.Locked= true;


cAll= (Excel.Range)this.Sheet.Columns[ "A:IV",
Type.Missing ];


try


{


cAll.Columns.Ungroup();


cAll.Columns.Ungroup();


cAll.Columns.Ungroup();


}


catch


{}


this.Sheet.Application.ActiveWindow.FreezePanes= false;


// Change default groupping behavior


this.Sheet.Outline.AutomaticStyles= false;


this.Sheet.Outline.SummaryRow=
Excel.XlSummaryRow.xlSummaryAbove;


this.Sheet.Outline.SummaryColumn=
Excel.XlSummaryColumn.xlSummaryOnRight;


}


//
---------------------------------------------------------------------------Â*---


/// <summary


/// Put all the bases into the worksheet and update the dropdown


/// </summary


protected void UpdateBase()


{//Added the try catch block to capture if any error occurs
while displaying the splash screen - Sreejesh


try


{


DataSet cDs=
this.cService.GetBaseProducts(this.App.UserName, this.DMP_APP_NAME,
DMP_MAIN_FORM );


int x= 1;


// Put bases data into the worksheet


//MessageBox.Show( "Before Foreach" ); //Sreejesh


foreach( DataRow r in cDs.Tables[0].Rows )


{


((Excel.Range)this.Sheet.Cells[ x, 1
]).Value2= r[1];


((Excel.Range)this.Sheet.Cells[ x++, 2
]).Value2= r[0];


}


//MessageBox.Show( "After foreach" ); //Sreejesh


// Create dropdown


Excel.Validation cVal=
((Excel.Range)this.Sheet.Cells[YOFFS - 2, 2]).Validation;


cVal.Delete();


string s= "=A1:A" + (x-1).ToString();


//MessageBox.Show( "aFTER Cval" ); //Sreejesh


cVal.Add(


Excel.XlDVType.xlValidateList,


Excel.XlDVAlertStyle.xlValidAlertStop,


Excel.XlFormatConditionOperator.xlBetween,


s,


"" );


cVal.IgnoreBlank = false;


cVal.InCellDropdown = true;


cVal.InputTitle = "";


cVal.ErrorTitle = "";


cVal.InputMessage = "";


cVal.ErrorMessage = "";


cVal.ShowInput = true;


cVal.ShowError = true;


}


catch(Exception e)


{


throw e;


}


}


//
---------------------------------------------------------------------------Â*---

 
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
system.Runtime.InteropServices.COMException (0x80020005): Typemism chan Excel Programming 0 September 25th 08 09:11 AM
Code fails after upgrading to Office 2007 djenkins Excel Programming 0 June 23rd 08 09:28 PM
querytable connection fails in Excel 2007 kk45 Excel Programming 0 March 19th 08 03:41 PM
getting System.Runtime.InteropServices.COMException Aruna Akella Excel Programming 0 August 7th 07 12:28 AM
System.Runtime.InteropServices.COMException (0x800A03EC) mina[_2_] Excel Programming 0 December 13th 06 09:51 AM


All times are GMT +1. The time now is 01:39 PM.

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"