Código
set exc=createobject("excel.application") set wss=createobject("wscript.shell") exc.visible = true ' preparando el archivo set ambiente = exc.workbooks.add() wss.sendkeys "+({f11})" wscript.sleep 200 wss.sendkeys "+({f11})" wscript.sleep 200 wss.sendkeys "+({f11})" wscript.sleep 200 wss.sendkeys "+({f11})" wscript.sleep 200 'preparando la hoja PCs set fecha1 = exc.range("B2") fecha1.interior.colorindex = 28 fecha1.formula = "Ingrese fecha" fecha1.borders.colorindex = 1 set fecha2 = exc.range("C2") fecha2.interior.colorindex = 28 fecha2.borders.colorindex = 1 fecha2.formula = "01-01-2012" fecha2.select wss.sendkeys "{f2}" wss.sendkeys "{enter}" set fecha3 = exc.range("C8") fecha3.interior.colorindex = 28 fecha3.borders.colorindex = 1 fecha3.formula = "=C2+1" fecha3.select wss.sendkeys "{f2}" wss.sendkeys "{enter}" set rango1 = exc.range("C10:H10") rango1.interior.colorindex = 1 rango1.font.colorindex = 4 rango1.font.bold = true exc.range("c10").formula = "PC 1" exc.range("d10").formula = "PC 2" exc.range("e10").formula = "PC 3" exc.range("f10").formula = "PC 4" exc.range("g10").formula = "PC 5" exc.range("h10").formula = "PC 6" set rango2 = exc.range("C11:h19") rango2.interior.colorindex = 15 rango2.borders.colorindex = 1 set rangof = exc.range("C20:H20") rangof.interior.colorindex = 28 rangof.borders.colorindex = 1 rangof.select set f1 = exc.range("C20") f1.formula = "=suma(C11:C19)" f1.select wss.sendkeys "{f2}" wss.sendkeys "{enter}" wscript.sleep 666 wss.sendkeys "{up}" wss.sendkeys "^(c)" wss.sendkeys "+({right})" wss.sendkeys "+({right})" wss.sendkeys "+({right})" wss.sendkeys "+({right})" wss.sendkeys "+({right})" wss.sendkeys "{enter}" wscript.sleep 200 set total = exc.range("H22") total.formula = "=suma(C11:H19)" total.select wss.sendkeys "{f2}" wss.sendkeys "{enter}" ' ------------------------- 'copiando el cuadro al resto de la hoja set stotal = exc.range("G22") stotal.formula = "Total" set rango3 = exc.range("C8:H22") rango3.select wss.sendkeys "^(c)" dim control control=1 ' bajar 16 y pegar do for i=1 to 20 step 1 wss.sendkeys "{down}" if control = 32 then exit do end if next wss.sendkeys "^(v)" wscript.sleep 200 control = control + 1 loop exc.columns("B").entirecolumn.autofit ' eso, el resto está listo para pasar a la siguiente hoja for x=8 to 628 step 20 if x>8 then resta= x-20 exc.cells(x, 3).formula = "=C"&resta&"+1" exc.cells(x, 3).select wss.sendkeys "{f2}" wss.sendkeys "{enter}" wscript.sleep 200 end if fecha2.formula = "" next exc.range("C8").formula = "=C2" exc.range("c8").select wss.sendkeys "{f2}" wss.sendkeys "{enter}" '***************************************** '***************************************** ' SEGUNDA HOJA '***************************************** '***************************************** wss.sendkeys "^{pgdn}"
De antemano gracias por sus respuestas
Saludos