If I export a data grid to Excel, how do I format the data ? ie I wish to put a border around the outside, make the top row of the grid grey background etc?
Use OLE automation (set reference to excel object library first):
Dim xlApp as Excel.Application
Dim xlWbk as Excel.Workbook
Set xlApp=CerateObject("Excel.Application"
Set xlWbk=xlApp.Workbooks.Open "Your Saved File Here"
Open your workbook, record formatting (Tools>Macro>Record new macro...), clear code, particularly change "Selection" to range references. Refer the code to xlWbk object.
Save workbook (xlWbk.Save).
Quit excel (xlApp.Quit).
Destroy objects (Set xlApp=Nothing).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.