FUNCTION MAIN()
LOCAL oExcel, oSheet
oExcel := TOleAuto():New( "Excel.Application" )
oExcel:WorkBooks:Add()
oSheet := oExcel:Get( "ActiveSheet" )
oSheet:Name := "Aba 1"
oSheet:Cells( 1, 1 ):Value := "Codigo"
oSheet:Cells( 1, 2 ):Value := "Nome"
oExcel:Sheets:Add()
oSheet := oExcel:Get( "ActiveSheet" )
oSheet:Name := "Aba 2"
oSheet:Cells( 1, 1 ):Value := "Data"
oSheet:Cells( 1, 2 ):Value := "Valor"
oSheet:Cells( 2, 2 ):Value := 30
oSheet:Cells( 3, 2 ):Value := 45
oSheet:Cells( 4, 2 ):Value := "=SOMA(B2:B3)" //Inserir Função
oSheet:Cells( 1, 1 ):Select()
oSheet:Protect("pctoledo") //Protege a Planilha Aba 2
oExcel:Visible := .T.
Return Nil
Abraços,