LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default C#NET2008 Excel Merge Cell Problem

ps. I have no idea if you need to use () or [] with that .resize() property.
(Or even if it works in C#.Net.

On 12/13/2010 14:45, Dave Peterson wrote:
First, I don't speak C#.net.

But in VBA, I'd use something like:

objWrkSheet.Cells(intRow, 1).resize(1,5).mergecells = true

So maybe...

//--- merge cells into one ---
objWrkSheet.Cells[intRow, 1].resize(1,5).mergecells = true;





On 12/13/2010 01:05, teeleong wrote:
Hello,
I am using C#NET 2008 and Version 2003 of Excel
At Row 1 trying to merge cell from Column 1 to Column 5 into a single cell to
insert the Customer Company name as Banner and my coding is not working due
to
my lack of knowledge.

--- Here the the coding. ---
private void FExportExcel()
{
using Microsoft.Office.Interop.Excel;

private Microsoft.Office.Interop.Excel.Application objExcel;
private Microsoft.Office.Interop.Excel.Workbook objWrkBook;
private Microsoft.Office.Interop.Excel.Worksheets objWrkSheet;
private Microsoft.Office.Interop.Excel.Range objWrkSheet_range;

int intRow = 1;
objExcel = new Microsoft.Office.Interop.Excel.Application();
objWrkBook = new objExcel.Workbooks;
objWrkSheet = new Worksheet();

//--- merge cells into one ---
objWrkSheet =(objWrkSheet.Cells[intRow, 1] ,
objWrkSheet.Cells[intRow,5]).MergeCells = true;

// --- insert Company name into merge cells ---
objWrkSheet.Cells[intRow, 1] ="Company Name :" +
this.txtCompanyName.Text;
}

Please help me. Once I got it working with you help, As an appreciate of your
help I will post the working coding here to share with other Newbies who may
have similar problem as

Thank You.
Regards.
Lennie



--
Dave Peterson
 
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
Merge Data problem from Excel to Word AndyC812 Excel Discussion (Misc queries) 2 June 12th 08 02:43 AM
Merge Cell Problem Jetrascal New Users to Excel 4 January 8th 08 09:15 AM
Open a mail merge from excel: common problem lightspeed Excel Programming 0 July 21st 06 02:09 PM
Open a mail merge from excel: common problem lightspeed Excel Programming 0 July 21st 06 02:03 PM
Excel/Word Mail Merge Problem AA[_2_] Excel Programming 0 September 19th 03 03:53 PM


All times are GMT +1. The time now is 02:52 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"