Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
ednetmanFormatExcel "c:\monthly\Report.xls" Sub ednetmanFormatExcel(ByVal vFilePath) Dim xlApp Set xlApp = CreateObject("excel.application") With xlApp.Workbooks.Open(vFilePath) 'open file With .ActiveSheet .Rows(1).Font.Bold = True '1. Bold the headers (always in row 1) .AutoFilterMode = False 'turn off any existing autofilter just in case .Rows(1).AutoFilter '2. Turn on AutoFilter for all coloms .Columns.AutoFit '3. Set Column width to AutoFit Selection '4. Set a freeze under column 1 so that the header is always present at the top .Range("A2").Select xlApp.ActiveWindow.FreezePanes = True End With .Close True 'save and close End With xlApp.Quit Set xlApp = Nothing End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.