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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Excel automation and defining a Name for Excel sheet

Excel automation and defining a Name for Excel sheet

Scheduled Pinned Locked Moved C#
csharpcomtestingtoolshelp
1 Posts 1 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.
  • D Offline
    D Offline
    dgap
    wrote on last edited by
    #1

    Hi guys, I am using C# to automate some Excel tasks and in it I am defining a name for an Excel sheet using (sheet).Names.Add("TableName", "=Sheet1!$A:$D", Type.Missing... (etc)) and when I open the Excel application that I created it defines the name a litte different than if I was to define it manually. When I define it manually it would be: Names in Workbook: TableName Refers to: =Sheet1!$A:$D Using C# automation it is: Names in Workbook: TableName Sheet1 Refers to: =Sheet1!$A:$D There is an extra right-justified "Sheet1" Appended to the Name!!! Because of that I have no way of referring to that table since it won't recognize it because of that "Sheet1"! I need to access that table using this code: cmdExcel = new OleDbCommand("Select * FROM TableName", cnExcel); But it won't recognize it due to that extra "Sheet1"! SOMEONE HELP! I'll be indebted to you for life! schoudhr@hotmail.com

    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