Click here to Skip to main content
15,917,638 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
Option Compare Database
Public Function format(filepath, sheetname)


Set xls = CreateObject("EXCEL.APPLICATION")
xls.screenupdating = False
xls.displayalerts = False
xls.Visible = True
xls.workbooks.Open filepath
Set xlsdd = xls.activeworkbook

xls.range("1:1").select
With xls.selection.Font
.Bold = True
.Name = "Arial"
        .Size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
End With

xls.sheets(sheetname).cells.Columns.autofit
xls.CutCopyMode = False
With xlsdd
.Save
.Close
End With
xls.Visible = False

Set xlsdd = Nothing
Set xls = Nothing

End Function
Posted
Comments
MT_ 4-Dec-12 5:15am    
To me it simply looks as if the function trying to do some formatting of a Excel file. Not sure if anyone would do line by line teaching what each one is doing. That you will have to do yourself. And Google is your friend.

It's formatting a cell. You could try running it for yourself to be sure.
 
Share this answer
 
This function actually formatting and setting the properties of the excel sheet file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900