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. Visual Basic
  4. How VB2008 set excel sheet header block (not sorting with its column)?

How VB2008 set excel sheet header block (not sorting with its column)?

Scheduled Pinned Locked Moved Visual Basic
algorithmshelptutorialquestion
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.
  • C Offline
    C Offline
    Curious 2009
    wrote on last edited by
    #1

    With VB2008 I am able to create a new Excel sheet as the following:

            Dim conn2 As New OleDbConnection()
            conn2.ConnectionString = m\_sExcelConnection
            conn2.Open()
            Dim cmd As New OleDbCommand()
    
            cmd.Connection = conn2
            cmd.CommandText = "CREATE TABLE Detail (Invoice\_No char(255),CheckIn char(255),CheckOut char(255),"
            cmd.CommandText += "RNum integer,Guest\_Name char(255),Base\_Room\_Charge Decimal,Service\_Charge Decimal,"
            cmd.CommandText += "HEBERGEMENT Decimal,TPS Decimal,TVQ Decimal,Total\_Taxes Decimal,Total\_Charges Decimal,"
            cmd.CommandText += "Total\_Deposit Decimal)"
    
            Try
                cmd.ExecuteNonQuery()
                conn2.Close()
            Catch ex As Exception
                conn2.Close()
            End Try
    

    - However, after I INSERT data into their columns then try to sorting each column, the Header also being sorting - But if I hight-light the Header row and right-click on it then selecting Cell Format --> Protection --> Mask ... then I can sort every column without touching the Headers *) Since the user probably doesn't know how to do like me, I would like to program it automatically with VB ... any one can help? Thanks in-advanced

    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