agregar hojas en excel

180 views
Skip to first unread message

Luis g

unread,
Aug 9, 2013, 4:08:13 PM8/9/13
to ayuda de fox
 
como puedo  agregar mas hojas en excel y cambiar el nombre 
y como puedo abrir un aexistente  y hacer lo mismo

Fidel Charny

unread,
Aug 9, 2013, 5:14:56 PM8/9/13
to publice...@googlegroups.com, luis_a...@hotmail.com
* Crear un libro y agregar una hoja con un nombre

lcNombreHoja="Nombre de la Hoja"
Oexcel = CREATEOBJECT("Excel.Application")
olibro=oexcel.workbooks.ADD()  && agrega una hoja (sheet)
XLSheet = oexcel.ActiveSheet
XLSheet.NAME=Proper(lcNombreHoja)  && asigna un nombre para la hoja.
*oExcel.visible=.t.


* Nombre de las hojas en un libro existente.

xcFile="\lcRuta\Archivo.xls"
oExcel = CREATEOBJECT("Excel.Application")
oLibro=oExcel.Workbooks.Open(xcfile)
qHOjas=oExcel.Sheets.Count

dimension ganame(qhojas)
for bas=1 to qHojas
ganame[bas]=oExcel.Sheets(bas).Name  && nombre de cada hoja
next

*oExcel.visible=.t.

oLibro.Close()
oExcel.Quit
oExcel=null

Reply all
Reply to author
Forward
0 new messages