|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Adding/copying Worksheet to ExcelI got 10 worksheets in workbook Master (file master.xls) and I wand to copy
them to the workbook B (file b.xls). How can I do this? I need to this for few thousand files. "Nicolas" wrote: This is code sample that shows how to add new worksheet in vb.net> I got 10 worksheets in workbook Master (file master.xls) and I wand to copy > them to the workbook B (file b.xls). > How can I do this? I need to this for few thousand files. Dim obook As Excel.Workbook Dim osheet As Excel.Worksheet obook = oexcel.Workbooks.Add osheet = oexcel.Worksheets(1) osheet.Name = "TEST1" osheet.Range("A1:AZ400").Interior.ColorIndex = 2 osheet.Range("A1").Font.Size = 12 osheet.Range("A1").Font.Bold = True osheet.Range("A1:I1").Merge() osheet.Range("A1").Value = "Excel Automation With Charts" osheet.Range("A1").EntireColumn.AutoFit() osheet.Range("A2").Font.Size = 12 osheet.Range("A2").Font.Bold = True osheet.Range("A2:I2").Merge() osheet.Range("A2").Value = "Excel Automation With Charts" osheet.Range("A2").EntireColumn.AutoFit() osheet = oexcel.worksheets(2) osheet.Name = "TEST2" osheet = oexcel.worksheets(3) osheet.Name = "TEST3" 'add worksheet osheet = CType(obook.Worksheets.Add(), Excel.Worksheet) osheet.Name = "TEST42222222222222222" osheet.Move(After:=obook.Worksheets(obook.Worksheets.Count)) obook.SaveAs("C:\TEST1.xls") obook.Close() obook = Nothing oexcel.Quit() oexcel = Nothing http://vbdotnettutorial.blogspot.com/search/label/Excel
Programmatically add Sub Menus to a ContextMenuStrip
HTML report in vb.net master - detail architecture for dataTable. textBox databinding. Sorry for reposting - can not figure out... Reading filenames into listbox Object disposal guidance needed Trouble With Timer Red TransparencyKey Not Working on Non Development Computer Add timer.tick event handler. |
|||||||||||||||||||||||