Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: cells workbooks ole
; Winbatch OLE with Excel Sample Script ; ; This sample will display Winbatch properties in Excel. ; ******************************************************************************** ; * ; * Excel Sample ; * objXL = ObjectOpen("Excel.Application") objXL.Visible = @TRUE zWorkbooks=objXL.WorkBooks zWorkbooks.Add ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ zColumns1=objXL.Columns(1) zColumns1.ColumnWidth = 20 zColumns2=objXL.Columns(2) zColumns2.ColumnWidth = 30 zColumns3=objXL.Columns(3) zColumns3.ColumnWidth = 40 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ zCells1=objXL.Cells(1, 1) zCells1.Value = "Property Name" zCells2=objXL.Cells(1, 2) zCells2.Value = "Value" zCells3=objXL.Cells(1, 3) zCells3.Value = "Description" ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ zRange=objXL.Range("A1:C1") zRange.Select ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ zSelection=objXL.Selection zFont=zSelection.Font zFont.Bold = @True ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;zSelection=objXL.Selection zColorIndex=zSelection.Interior zColorIndex.ColorIndex = 1 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;zSelection=objXL.Selection zInterior=zSelection.Interior zInterior.Pattern = 1 ;xlSolid ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;zSelection=objXL.Selection zFont=zSelection.Font zFont.ColorIndex = 2 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ zColumnsB=objXL.Columns("B:B") zColumnsB.Select ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;zSelection=objXL.Selection ;zSelection.HorizontalAlignment = &hFFFFEFDD ; xlLeft zSelection.HorizontalAlignment = 4294963165 ; xlLeft ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Write properties to Excel ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;Line #2 - Name of Script Interpreter strName="Name" strValue=WinExeName("") strDesc="Name of Script Interpreter" intIndex = 2 gosub Show ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;Line #3 - Application Version strName="Version" strValue=Version() strDesc="Application Version" gosub Show ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;Line #4 - Fully Qualified File Name strName="FullName" strValue=IntControl (1004, 0, 0, 0, 0) strDesc="Fully Qualified File Name" gosub Show ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;Line #3 - Path to Script File strName="Path" strValue=FilePath(strValue) strDesc="Path to Script File" gosub Show ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;Line #4 - Command Line Arguments strName="Arguments" strValue=param0 strDesc="Number of Command Line Arguments" gosub Show if strValue != 0 For i = 0 to xArgCount - 1 xCells1.Value = strcat("Argument(",i,")") xCells2.Value=param%i% xCells3.Value="Command Line Argument #%i%" intIndex = intIndex + 1 xCells1.Select Next endif ; ******************************************************************************** ;; * while @false :Show xCells1=objXL.Cells(intIndex, 1) xCells1.Value=strName xCells2=objXL.Cells(intIndex, 2) xCells2.Value=strValue xCells3=objXL.Cells(intIndex, 3) xCells3.Value=strDesc intIndex = intIndex + 1 xCells1.Select return endwhile
Article ID: W13667
Filename: OLE and Excel - Adding Cells to Workbook.txt
File Created: 1999:04:15:16:55:34
Last Updated: 1999:04:15:16:55:34