Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > VB.net, excel - copying excel file attributes
 

VB.net, excel - copying excel file attributes

I have several excel files that I want to merge together into a new excel file. Each excel files follow the same format, differing only in the number of rows they have. In each excel file, the top three rows are repeating (in Excel: File->Page Setup->Sheet->Print-Titles->Rows to Repeat at Top).

Iwas able to getthe files to merge together, but I cannot get thetop three rows to repeat at the top.How can I recreatethisbehavior using VB.net?

here is a snippet of my code:

'only write the repeating rows once

If fileCount = 1 Then

xlBook.ActiveSheet.Range("A1:H" & 3).Copy()

mergedXlBook.ActiveSheet.Range("A1:H" & 3).PasteSpecial(Excel.XlPasteType.xlPasteAll)

mergedXlBook.ActiveSheet.Range("A1:H" & 3).PasteSpecial(Excel.XlPasteType.xlPasteColumnWidths)

mergedXlBook.ActiveSheet.Rows.Autofit()

mergedXlBook.ActiveSheet.Columns.Autofit()

End If

henry12345  Wednesday, January 16, 2008 6:16 PM

Hi,

You can just call ActiveSheet.PageSetup.PrintTitleRows = "$1: $3".

Code Block

ActiveSheet.PageSetup.PrintTitleRows = "$1:$3"

Thanks

Ji

Ji.Zhou  Monday, January 21, 2008 6:10 AM

Hi,

You can just call ActiveSheet.PageSetup.PrintTitleRows = "$1: $3".

Code Block

ActiveSheet.PageSetup.PrintTitleRows = "$1:$3"

Thanks

Ji

Ji.Zhou  Monday, January 21, 2008 6:10 AM

How do you merge excel files? Can you help me.

mrleokarthik_  Tuesday, August 05, 2008 2:26 PM
hello dear
I opened the word document in the axwebbrowser.it is working very fine. but now i want to add new command (like any button. that when i click the button some text added in the word document opened in the axwebbrowser. any thing like this.). would you help me in this context my job in depend over this issue.

with regard
Munish bhargav

Munish Bhargav  Thursday, August 21, 2008 6:33 AM

You can use google to search for other answers

Custom Search

More Threads

• Could not load file or assembly ?
• IsDBNull problem
• VB.Net & WinApi & Infragistics controls
• Convert String to Decimal!!!!!!
• Show execution time string value
• VB Classes
• Change Connection string at runtime
• Using FileGet to read Array in Structure (VB.NET Express Beta2)
• Playing sound from resources doesn
• Reading selected item value of a Combobox in a datagirdview control