Tengo un grupo de datos el cual los copio de un archivo y los pego en otro
pero cuando pongo este codigo en el libro, y a la vez otros que estan mas
adelante
Option Explicit
Private Sub Workbook_Open()
'Quita los colores a los hyperlinks
Sheets("Inicio").Select
ActiveSheet.Unprotect ("password")
With ActiveWorkbook.Styles("Hyperlink")
.IncludeNumber = False
.IncludeFont = False
.IncludeAlignment = False
.IncludeBorder = False
.IncludePatterns = False
.IncludeProtection = False
End With
Selection.Style = "Hyperlink"
ChDir "C:\Servicio Medico"
Application.MoveAfterReturnDirection = xlToRight
Excel.CommandBars("Worksheet Menu Bar").Enabled = False
With Application
.DisplayFullScreen = True
.DisplayAlerts = False
.DisplayScrollBars = False
End With
With ActiveWindow
.DisplayHeadings = False
End With
ActiveSheet.Protect ("password")
welcome.Show
End Sub
LOS DEMAS DEL LIBRO EN GENERAL
Private Sub Workbook_Activate()
activas
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
antesdecerrar
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
activas
End Sub
Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window)
activas
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As Excel.Window)
ventananoactiva
End Sub
Y LOS MODULOS
Option Explicit
Sub antesdecerrar()
Application.MoveAfterReturnDirection = xlDown
' Sheets("inicio").Select
Application.DisplayFullScreen = False
Excel.CommandBars("Worksheet Menu Bar").Enabled = True
Application.DisplayFormulaBar = True
Application.DisplayScrollBars = True
Application.CommandBars("Formatting").Visible = True
With ActiveWindow
.DisplayHeadings = True
End With
Application.CommandBars("Standard").Visible = True
Application.CommandBars("Worksheet Menu Bar").Reset
ActiveWindow.Close savechanges:=False
End Sub
Sub activas()
Application.CommandBars("Full Screen").Visible = False
Application.DisplayFullScreen = True
Excel.CommandBars("Worksheet Menu Bar").Enabled = False
Application.DisplayFormulaBar = False
Application.DisplayScrollBars = False
With ActiveWindow
.DisplayHeadings = False
End With
End Sub
Sub ventananoactiva()
Application.CommandBars("Worksheet Menu Bar").Reset
Excel.CommandBars("Worksheet Menu Bar").Enabled = True
Application.DisplayFullScreen = False
Application.DisplayScrollBars = True
Application.DisplayFormulaBar = True
With ActiveWindow
.DisplayHeadings = True
End With
Application.CommandBars("Standard").Visible = True
End Sub
Sub
NO SE SI SEA EL PASSWORD O COMO ESTOY MANEJANDO
LAS VENTANAS, POR QUE AL PARECER PIERDE LO QUE VA A PEGAR
AQUI PONGO EL CODIGO DE COPIAR Y PEGAR
Sub addinformes()
Application.ScreenUpdating = False
'Ingresa al informe los datos a guardar del paciente
Dim mesinforme As String
mesinforme = Worksheets("Medico").Range("clave").Value & ".xls"
'=Checa si el libro esta abierto o cerrado
Dim sLibro As String, oLibro As Workbook
sLibro = "C:\Servicio Medico\Informes\" & mesinforme
On Error Resume Next
Set oLibro = Workbooks(Dir(sLibro))
On Error GoTo 0
If oLibro Is Nothing Then Set oLibro = Workbooks.Open(sLibro)
'Aqui el codigo
Windows("Panel Gral.xls").Activate
Sheets("Setup").Select
Dim NextRow As Long
Range("B17:B66").Select
Selection.Copy
Windows(mesinforme).Activate
NextRow = Worksheets("Informe").Range("A65536").End(xlUp).Row + 1
Range("A" & NextRow).Select
'= Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True
'= 'AQUI ES DONDE ME MARCA EL ERROR, YA NO LO QUIERE PEGAR
ActiveWindow.Close savechanges:=True
Windows("Panel Gral.xls").Activate
Sheets("Paciente").Select
Range("Z4").Select
Application.ScreenUpdating = True
End Sub
LES AGRADECERE ME COMENTEN AL RESPECTO.
GRACIAS.
Leer las respuestas