PDA

View Full Version : Access VBA To Maniuplate Excel



jo15765
08-08-2016, 07:24 AM
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

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