Consulting

Results 1 to 1 of 1

Thread: Access VBA To Maniuplate Excel

  1. #1
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location

    Access VBA To Maniuplate Excel

    I am exporting an access table to excel, then opening the excel workbook to make a few quick tweaks. The only thing I can not figure out how to do in Access VBA are
    1) Turn filtering (for Row 1:1) on for the workbook.



    How is this done in Excel through Access VBA?

    This is my current syntax that is working to bold row 1 and filter
    [vba]
    Public Sub FormatWorksheetBeforeSending(outputFileName)
    Dim xls As Excel.Application, wb As Excel.Workbook, ws As Excel.Worksheet
    Set xls = New Excel.Application
    Set wb = xls.Workbooks.Open(outputFileName)
    Set ws = wb.Worksheets(1)


    ws.Name = "ABC"
    ws.Rows("1:1").Font.Bold = True
    ws.Cells.Select
    ws.Cells.EntireColumn.AutoFit
    Columns("AS:AS").Select
    Selection.Delete Shift:=xlToLeft
    Columns("A:A").Select
    Selection.Delete Shift:=xlToLeft
    Range("A1").Select

    wb.Save
    wb.Close

    Set ws = Nothing
    Set wb = Nothing
    xls.Quit
    Set xls = Nothing


    End Sub
    [/vba]
    Last edited by jo15765; 08-08-2016 at 07:39 AM.
    Go to Heaven for the climate, Hell for the company.
    ~~Mark Twain

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •