First you must have an Excel object to work with, you can create it or refer to a workbook already open.
This example creates it:
This example focus and activate an Excel already open:
define and print last row with data:
data dummy and select:
To work with VBA functions that needs arguments, is necessary to input the Enum Value insted of Enum Name, for example the Enum Value -4163 = the Enum Name xlPasteValues, the Enum Value -4142 = Enum Name xlNone.
copy and paste only values:
Last piece code line should be the translate this VBA code:
Best Regards
This example creates it:
typelib Excel
Excel.Application a._create
Excel.Workbook b=a.Workbooks.Add()
ExcelSheet es.ws=b.Worksheets.Item(1)
es.Activate(4) ;;activate Excel
es.ws.Application.Sheets.Item(1).Name = "Plan de Trabajo y Retorno del C"
int w=win("" "XLMAIN")
max w
str f.expandpath("$desktop$\test45.xls")
del f; err
b.SaveAs(f @ @ @ @ @ 1)
es.ws.Application.ActiveWindow.Zoom=85
This example focus and activate an Excel already open:
Excel.Workbook x._getfile("$desktop$\test45.xls")
Excel.Application a=x.Application
ExcelSheet es.ws=x.Worksheets.Item(1)
a.Visible=TRUE; err
Excel.Windows ws=a.Windows
Excel.Window w=ws.Item(1)
w.Visible=TRUE
int w1=win("Microsoft Excel - test45.xls" "XLMAIN")
act w1
define and print last row with data:
int ultima_fila = es.ws.Application.ActiveSheet.Range("A1").End(xlDown).Row
out ultima_fila
data dummy and select:
es.ws.Application.ActiveSheet.Range("A1:A5").Value = "XXX YYY ZZZ"
int ultima_fila = es.ws.Application.ActiveSheet.Range("A1").End(xlDown).Row
es.ws.Application.ActiveSheet.Range(F"A1:A{ultima_fila}").Select
To work with VBA functions that needs arguments, is necessary to input the Enum Value insted of Enum Name, for example the Enum Value -4163 = the Enum Name xlPasteValues, the Enum Value -4142 = Enum Name xlNone.
copy and paste only values:
es.ws.Application.Selection.copy
es.ws.Application.Range("E1").PasteSpecial(-4163,-4142,,)
Last piece code line should be the translate this VBA code:
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Best Regards