VbScript Add SAP Output Excel style...

SAP Output the Excel not has any style, so need use the three software or program process it.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

-Use VBA Program Process Excel File. Add Color, Set Font Blod..ect.

Program Name: Lilo_Excel.vbs

Set objExcel = CreateObject("Excel.Application")

Dim StrFile

StrFile = "D:\Daily_PO_Release_Report.xls"

Set objWorkbook = objExcel.Workbooks.Open(StrFile)

'objExcel.Visible = True ' Show

'objExcel.Visible = False 'Not Show

Set objRange = objExcel.Range("A1", "D1")

objRange.Font.Size = 11

objRange.Font.Bold = True

Set objRange = objExcel.Range("A1", "D1")

'objRange.Interior.ColorIndex = 14

'objRange.Select

Set objRange = objExcel.Range("A1:D3")

objRange.Borders.LineStyle = 1 ' 1~13 13种线条样式

Set objRange = objExcel.Range("A6:T65535")

objRange.Clear

Set objRange = objExcel.ActiveCell.EntireColumn

objRange.AutoFit()

objExcel.DisplayAlerts = False 'Close the Alert

objExcel.ActiveWorkbook.SaveAs StrFile, -4143

objExcel.DisplayAlerts = False ''Close the Save Alert

objExcel.ActiveWorkbook.Close

objExcel.DisplayAlerts = False

objExcel.Application.Quit

---If You want call the program with parameter like this:

C:\cmd

C:\ Lilo_Excel File_Name

Pls Change the program:

Lilo_Excel.vbs

set arg=wscript.arguments

'msgbox(arg(0))

'wscript.echo(arg(0))

Set objExcel = CreateObject("Excel.Application")

Dim StrFile

'StrFile = "D:\Daily_PO_Release_Report.xls"

StrFile = arg(0)

Set objWorkbook = objExcel.Workbooks.Open(StrFile)

'objExcel.Visible = True

'objExcel.Visible = False

Set objRange = objExcel.Range("A1","D1")

objRange.Font.Size = 11

objrange.Font.Bold = True

Set objRange = objExcel.Range("A1","D1")

'objRange.Interior.ColorIndex = 14

'objRange.Select

Set objRange = objExcel.Range("A1:D3")

objRange.Borders.LineStyle = 1 ' 1~13 13种线条样式

Set objRange = objExcel.Range("A6:T65535")

objRange.Clear

Set objRange = objExcel.ActiveCell.EntireColumn

objRange.AutoFit()

objExcel.DisplayAlerts = False 'Close the Alert

objExcel.ActiveWorkBook.SaveAS strFile,-4143

objExcel.DisplayAlerts = False ''Close the Save Alert

objExcel.ActiveWorkbook.Close

objExcel.DisplayAlerts = False

objExcel.Application.Quit

你可能感兴趣的:(Excel,Microsoft,Office,VBScript,VBA)