'Apply AutoFormat to data
ConstxpRangeAutoFormatList2=11
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
SetobjWorkbook=objExcel.Workbooks.Add()
SetobjWorksheet=objWorkbook.Worksheets(1)
k=1
Fori=1to10
Forj=1to10
objWorksheet.Cells(i,j)=k
k=k+1
Next
Next
SetobjRange=objWorksheet.UsedRange
objRange.AutoFormat(xpRangeAutoFormatList2)
'SortaMicrosoftExcelWorksheet
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
SetobjWorkbook=objExcel.Workbooks.Add
SetobjWorksheet=objWorkbook.Worksheets(1)
objExcel.Cells(1,1).Value="4"
objExcel.Cells(2,1).Value="1"
objExcel.Cells(3,1).Value="2"
objExcel.Cells(4,1).Value="3"
objExcel.Cells(1,2).Value="A"
objExcel.Cells(2,2).Value="B"
objExcel.Cells(3,2).Value="C"
objExcel.Cells(4,2).Value="D"
SetobjRange=objWorksheet.UsedRange
SetobjRange2=objExcel.Range("A1")
objRange.Sort(objRange2)
'AddFormattedDatatoaSpreadsheet
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.Add
objExcel.Cells(1,1).Value="Testvalue"
objExcel.Cells(1,1).Font.Bold=TRUE
objExcel.Cells(1,1).Font.Size=24
objExcel.Cells(1,1).Font.ColorIndex=3
'AutoFitColumnsinaMicrosoftExcelWorksheet
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
SetobjWorkbook=objExcel.Workbooks.Add()
SetobjWorksheet=objWorkbook.Worksheets(1)
x=1
strComputer="."
SetobjWMIService=_
GetObject("winmgmts:\\"&strComputer&"\root\cimv2")
SetcolItems=objWMIService.ExecQuery_
("Select*fromWin32_Service")
ForEachobjItemincolItems
objWorksheet.Cells(x,1)=objItem.Name
objWorksheet.Cells(x,2)=objItem.DisplayName
objWorksheet.Cells(x,3)=objItem.State
x=x+1
Next
SetobjRange=objWorksheet.UsedRange
objRange.EntireColumn.Autofit()
'ListServiceDatainaSpreadsheet
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.Add
x=1
strComputer="."
SetobjWMIService=GetObject_
("winmgmts:\\"&strComputer&"\root\cimv2")
SetcolServices=objWMIService.ExecQuery_
("Select*FromWin32_Service")
ForEachobjServiceincolServices
objExcel.Cells(x,1)=objService.Name
objExcel.Cells(x,2)=objService.State
x=x+1
Next
Alerter Stopped
ALG Running
AppMgmt Stopped
aspnet Stopped
AudioSrv Running
BITS Running
Browser Running
'FormataRangeofCells
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.Add
objExcel.Cells(1,1).Value="Name"
objExcel.Cells(1,1).Font.Bold=TRUE
objExcel.Cells(1,1).Interior.ColorIndex=30
objExcel.Cells(1,1).Font.ColorIndex=2
objExcel.Cells(2,1).Value="Testvalue1"
objExcel.Cells(3,1).Value="Testvalue2"
objExcel.Cells(4,1).Value="Tetsvalue3"
objExcel.Cells(5,1).Value="Testvalue4"
SetobjRange=objExcel.Range("A1","A5")
objRange.Font.Size=14
SetobjRange=objExcel.Range("A2","A5")
objRange.Interior.ColorIndex=36
SetobjRange=objExcel.ActiveCell.EntireColumn
objRange.AutoFit()
ConstxpRangeAutoFormatList2=11
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
SetobjWorkbook=objExcel.Workbooks.Add()
SetobjWorksheet=objWorkbook.Worksheets(1)
k=1
Fori=1to10
Forj=1to10
objWorksheet.Cells(i,j)=k
k=k+1
Next
Next
SetobjRange=objWorksheet.UsedRange
objRange.AutoFormat(xpRangeAutoFormatList2)
'SortaMicrosoftExcelWorksheet
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
SetobjWorkbook=objExcel.Workbooks.Add
SetobjWorksheet=objWorkbook.Worksheets(1)
objExcel.Cells(1,1).Value="4"
objExcel.Cells(2,1).Value="1"
objExcel.Cells(3,1).Value="2"
objExcel.Cells(4,1).Value="3"
objExcel.Cells(1,2).Value="A"
objExcel.Cells(2,2).Value="B"
objExcel.Cells(3,2).Value="C"
objExcel.Cells(4,2).Value="D"
SetobjRange=objWorksheet.UsedRange
SetobjRange2=objExcel.Range("A1")
objRange.Sort(objRange2)
'AddFormattedDatatoaSpreadsheet
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.Add
objExcel.Cells(1,1).Value="Testvalue"
objExcel.Cells(1,1).Font.Bold=TRUE
objExcel.Cells(1,1).Font.Size=24
objExcel.Cells(1,1).Font.ColorIndex=3
'AutoFitColumnsinaMicrosoftExcelWorksheet
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
SetobjWorkbook=objExcel.Workbooks.Add()
SetobjWorksheet=objWorkbook.Worksheets(1)
x=1
strComputer="."
SetobjWMIService=_
GetObject("winmgmts:\\"&strComputer&"\root\cimv2")
SetcolItems=objWMIService.ExecQuery_
("Select*fromWin32_Service")
ForEachobjItemincolItems
objWorksheet.Cells(x,1)=objItem.Name
objWorksheet.Cells(x,2)=objItem.DisplayName
objWorksheet.Cells(x,3)=objItem.State
x=x+1
Next
SetobjRange=objWorksheet.UsedRange
objRange.EntireColumn.Autofit()
'ListServiceDatainaSpreadsheet
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.Add
x=1
strComputer="."
SetobjWMIService=GetObject_
("winmgmts:\\"&strComputer&"\root\cimv2")
SetcolServices=objWMIService.ExecQuery_
("Select*FromWin32_Service")
ForEachobjServiceincolServices
objExcel.Cells(x,1)=objService.Name
objExcel.Cells(x,2)=objService.State
x=x+1
Next
Alerter Stopped
ALG Running
AppMgmt Stopped
aspnet Stopped
AudioSrv Running
BITS Running
Browser Running
'FormataRangeofCells
SetobjExcel=CreateObject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.Add
objExcel.Cells(1,1).Value="Name"
objExcel.Cells(1,1).Font.Bold=TRUE
objExcel.Cells(1,1).Interior.ColorIndex=30
objExcel.Cells(1,1).Font.ColorIndex=2
objExcel.Cells(2,1).Value="Testvalue1"
objExcel.Cells(3,1).Value="Testvalue2"
objExcel.Cells(4,1).Value="Tetsvalue3"
objExcel.Cells(5,1).Value="Testvalue4"
SetobjRange=objExcel.Range("A1","A5")
objRange.Font.Size=14
SetobjRange=objExcel.Range("A2","A5")
objRange.Interior.ColorIndex=36
SetobjRange=objExcel.ActiveCell.EntireColumn
objRange.AutoFit()
No comments:
Post a Comment