El código es:
Option Explicit
Dim xl As Excel.Application
Dim xlw As Excel.Workbook
Dim xls As Excel.Worksheet
Dim xlr As Excel.Range
Private Sub Form_Load()
Set xl = CreateObject("Excel.Application")
Set xlw = GetObject("c:\SCMB\certificado1-1.xls")
Set xls = xlw.Worksheets(1)
Set xlr = xls.Range("a1:z1000")
'Por decir
xls.Range("H48").Value = Now
xls.PageSetup.PrintArea = "A1:J256"
xls.PageSetup.Zoom = False
xls.PageSetup.FitToPagesWide = 1
xls.PageSetup.FitToPagesTall = 50
On Error GoTo sig
xls.Select
xl.Visible = True
sig:
'Windows(1).Activate
'Windows(1).Visible = True
'xls.Application.DisplayFullScreen = True
'xls.Application.DisplayFullScreen = False
xlw.Save
Set xlr = Nothing
Set xl = Nothing
Set xlw = Nothing
Set xls = Nothing
End Sub
Y po's cuando lo corro en una aplicación con una sola forma no hay problema pero cuando lo correo con una que tiene varias formas, me marca error en:
'Windows(1).Activate
'Windows(1).Visible = True
"El sibindicce esta fuera de rango"
Lo mismo me pasa si lo corro cuando tengo una forma y abierto el Excel
Si me podrias ayudar porque no encuentro como
GRACIAS TOTALES