Mengontrol Ms.Excel melalui delphi
uses ComObj; var ExcelApp: OleVariant; implementation procedure TForm1.Button1Click(Sender: TObject); const // SheetType xlChart = -4109; xlWorksheet = -4167; // WBATemplate xlWBATWorksheet = -4167; xlWBATChart = -4109; // Page Setup xlPortrait = 1; xlLandscape = 2; xlPaperA4 = 9; // Format Cells xlBottom = -4107; xlLeft = -4131; xlRight = -4152; xlTop = -4160; // Text Alignment xlHAlignCenter = -4108; xlVAlignCenter = -4108; // Cell Borders xlThick = 4; xlThin = 2; var ColumnRange: OleVariant; // Function to get the number of Rows in a Certain column function GetLastLine(AColumn: Integer): Integer; const xlUp = 3; begin Result := ExcelApp.Range[Char(96 + AColumn) + IntToStr(65536)].end[xlUp].Rows.Row; end; begin { Start Excel } // By using GetActiveOleObject, you use an instance of Word that's already running, // if there is one. try ExcelApp := GetActiveOleObject('Excel.Application'); except try // If no instance of Word is running, try to Create a new Excel Object...