Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Rename Excel sheets after exporting to a new Excel spreadsheet

Rename Excel sheets after exporting to a new Excel spreadsheet

Scheduled Pinned Locked Moved C#
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Walaza
    wrote on last edited by
    #1

    Hi, I have an application that exports data from a datagrid to an excel spreadsheet. The export works perfectly but I have been struggling to get code that renames the sheets from the default (Sheet1, Sheet2, etc) to the name that I want. Can someone help.

    Mvelo Walaza Developer Telkom SA

    C 1 Reply Last reply
    0
    • W Walaza

      Hi, I have an application that exports data from a datagrid to an excel spreadsheet. The export works perfectly but I have been struggling to get code that renames the sheets from the default (Sheet1, Sheet2, etc) to the name that I want. Can someone help.

      Mvelo Walaza Developer Telkom SA

      C Offline
      C Offline
      cocoonwls
      wrote on last edited by
      #2

      May be you can have a look on this http://support.microsoft.com/kb/316934[^] and this http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.3.0/SpreadsheetGear~SpreadsheetGear.IWorksheets.html[^] hope this help you ;)

      modified on Friday, April 18, 2008 9:24 AM

      W 1 Reply Last reply
      0
      • C cocoonwls

        May be you can have a look on this http://support.microsoft.com/kb/316934[^] and this http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.3.0/SpreadsheetGear~SpreadsheetGear.IWorksheets.html[^] hope this help you ;)

        modified on Friday, April 18, 2008 9:24 AM

        W Offline
        W Offline
        Walaza
        wrote on last edited by
        #3

        Hi, Thanx 4 the reply!! But what is a Spreadsheetgear? Below is the code that I use and it gives me an error: //create new worksheet Microsoft.Office.Interop.Excel._Application _appClass = new ApplicationClass(); _appClass.Visible = true; _appClass.Caption = "Exported ECS Errors"; Microsoft.Office.Interop.Excel.Workbook wbk = _appClass.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); wbk.Worksheets["Sheet1"] = "Mvelo"; Please explain what the Spreadsheetgear is/provide me with a solution to this code.

        Mvelo Walaza Developer Telkom SA

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups