473,770 Members | 6,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Excel] Why does Range.Group() method crash after 7 calls?

Hello,

I have a problem with Microsoft.Offic e.Interop.Excel .Range.Group()
method.

The problem is that I can call this method only 7 times, before it
throws me an exception.

I don't understand quite well why this happens, and for witch
documents this affirmation is valid, but the problem exists, probably,
for a large files.

For example, if you save this file - http://serhio.atspace.com/ExcelData.xls
on the drive C, and executes the following code:
(see herea formatted variant of this post:
http://forums.microsoft.com/Forums/S...36692&SiteID=1
)

_______________ _______________ _______________ ___

static void Main(string[] args)
{
Microsoft.Offic e.Interop.Excel .Application excelApp = new
ApplicationClas s();
excelApp.Visibl e = true; // Makes Excel visible to the
user.

string workbookPath = @"C:\ExcelData. xls"; // Add your
own path here
// The following code opens an existing workbook
Workbook excelWorkbook =
excelApp.Workbo oks.Open(workbo okPath, 0,
false, 5, "", "", false, XlPlatform.xlWi ndows, "",
true,
false, 0, true, false, false);

// The following gets the first Woorksheet
Worksheet worksheet = excelWorkbook.W orksheets.get_I tem(1)
as Worksheet;
worksheet.Outli ne.SummaryRow =
XlSummaryRow.xl SummaryAbove;

Range aRange;
int groupCounter = 0;
try
{
for (int i = 10; i < 450; i = i + 11)
{
aRange =
worksheet.get_R ange(string.For mat("C{0}:C{1}" , i, i + 10),
Missing.Value);
aRange.Group(Mi ssing.Value, Missing.Value,
Missing.Value, Missing.Value);
groupCounter++;
}
}
catch (Exception ex)
{
throw ex;
}
}
_______________ _______________ _______________ ___

Is there somebody qho can explain this behavior, and how can I resolve
this issue?

Thanks a lot
/sergiu
Jun 27 '08 #1
0 1693

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
35561
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
17
27285
by: Ange T | last post by:
Hi there, I'm having pain with the VB behind an Access form. The form is used to create reports in Excel based on the details entered in the form. This has always worked without error on my machine (NT4, Access 2k), however as soon as I attempt to create anything on another machine (NT4, Access 2k) which most users will be working from, I receive an automation error. The problem line with the code is:
0
3107
by: ImraneA | last post by:
Hi there Many thanks to those people who contributed to this group, helped me greatly. Enclose, my code, hope it helps others :- Public Function Export_Excel_9(tbx1 As Variant, tbx2 As Variant, tbx3 As Variant, tbx4 As Variant, tbx5 As Variant, tbx6 As Variant, tbx7 As
3
2806
by: Carlos Magalhaes | last post by:
Hey All, I am doing some excel automation using the excel COM. I can do most of the functions and its working well until I come across a formula. I can run a formula and insert the formula value into a cell. BUT this is where it comes "complex".
1
1491
by: Vanajakshi Pidatala | last post by:
Hello, I am trying to show data in dataset in to an excel sheet(ASP.NET/VB.NET). I AM DOING THIS ON SERVER(IIS SERVER) WHICH HAS EXCEL VERSION 9. I COULD ADD REFERENCE TO EXCEL VERSION 9 AND OFFICE VERSION 10 IN MY PROJECT. I DO NOT HAVE EXC EL VERSION 10 TO WHICH I CAN ADD REFERENCE (WHICH I THINK IS THE PROBLEM). i AM GETTING THE ERROR ' REFERENCE TO NULL OBJECT AT THE CODE line Dim excelBook As Excel.Workbook =...
7
2689
by: Alan Roberts | last post by:
Can someone please explain the following for me... I am trying to link to a .NET DLL from Excel. Excel needs to pass a reference to itself to the DLL and then the DLL needs to perform some work on the running instance of Excel via that reference. As an example, a VB DLL to return the path to the current active workbook contains the following (in addition to the COM GUIDS automatically added to a new COMClass)... Public Class Class1...
18
8290
by: Frank M. Walter | last post by:
Hello, I have made an small AddIn with udf for excel 2003. I use vs2003. The point of view is the function __T() I call it in excel sheet writing =__T() I am not able to set a value to a given cell. region.Value2="qwe"; //bumm! A exception will be trown. On all PCs with excel. HRESULT 0x800A03EC
9
4549
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso TypeOf obj Is IDisposable Then DirectCast(obj, IDisposable).Dispose()
3
6311
by: Ray | last post by:
Hi, I'm working on something with mysql and excel. I'm using python and win32com. All major function works, But I have two problems: 1. the output need to do "auto fit" to make it readable. I tried to call "xlApp.Columns.AutoFit=1" the whole program will crash, but without xlApp.Columns.AutoFit=1, everything just fine.
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.