Results 1 to 3 of 3
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839

    Rename Excel header column


    Code:
    Dim WkBkA As Excel.Workbook
    Set xlApp = New Excel.Application
          xlApp.Visible = False
              Set WkBkA = Workbooks.Open("C:\Temp\" & " NIE & " Weekly Summary - " & Tod & ".html")    'develops the file name and location
                  WkBkA.Sheets(1).Rows(1).Delete                                                         'Deletes first row
                     WkBkA.Sheets(1).Rows(1).Font.Bold = True                                        'Bold formatting
                       WkBkA.Sheets(1).Columns(3).                                                        'Modify output column header to new string 
                 WkBkA.SaveAs ("C:\Temp\" & NIE & " Weekly Summary - " & Tod), 51          'saves the new file 
     Excel.Application.Quit
    I'm looking to modify the column name I've googled and such already but all I get is ranges in excel or the simple formatting changes like bold.

    Thanks

  2. #2
    John_G is offline VIP
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Excel does not have column headers as a distinct item. Column "headers" are just cells in row 1 (and sometimes more) which are formatted to look like headers - bold, coloured background, etc.

    You refer to those just as you would any other cell, so your statement might be something like:

    WkBkA.Sheets(1).Cells(1, 3) = "New Test"


    I'm not sure I have that syntax right, it's been a while since I've used it!

  3. #3
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Worked like a charm. Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 01-12-2017, 02:30 AM
  2. ALTER TABLE rename a column
    By rockell333 in forum Queries
    Replies: 8
    Last Post: 09-18-2015, 02:59 PM
  3. rename column header name in subform during run time
    By selvakumar.arc in forum Forms
    Replies: 5
    Last Post: 08-07-2013, 02:40 PM
  4. using macro to rename column values in Access
    By coolbear91 in forum Programming
    Replies: 1
    Last Post: 02-20-2013, 11:10 PM
  5. Dates as Column Header
    By afvillodres in forum Queries
    Replies: 1
    Last Post: 07-24-2012, 06:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums