Posts

Showing posts from 2010

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...

Mengirim email Melalui Ms.Outlook di delphi

const olMailItem = 0; var Outlook: OLEVariant; MailItem: Variant; begin try Outlook:=GetActiveOleObject('Outlook.Application'); except Outlook:=CreateOleObject('Outlook.Application'); end; MailItem := Outlook.CreateItem(olMailItem); with MailItem do begin Recipients.Add('delphi.guide@about.com'); Subject := 'Subject: Outlook Mail From Delphi'; Body := 'Welcome to my homepage: http://delphi.about.com'; Attachments.Add('C:\Windows\Win.ini'); Send; end; Outlook := Unassigned; end; sumber : Tips Explorer 2007

Function untuk mendapatkan nilai terbilang

function TForm1.terbilang(x: Int64): string; const abil : array[0..11] of string[10]=('','satu','dua','tiga', 'empat','lima','enam','tujuh','delapan','sembilan', 'sepuluh','sebelas'); begin if (x else if (x else if (x else if (x else if (x else if (x else if (x else if (x end; keterangan..: untuk variabel diatas menggunakan int64 agar jumlah angka yang di konversi bisa mencapai milyar,, jika menggunakan integer biasa maka hanya bisa digunakan sampai level juta