Agregar a esta macro la hora, para no pisar la foto anterior

Necesitaría agregar a esta macro la hora, para no pisar la foto anteriormente hecha.

Sub TomaFoto()
' Código para TOMAR FOTO
ActiveSheet.Unprotect Password:="1"
Application.DisplayAlerts = False
On Error Resume Next
Sheets("FOTO1").Activate
Dim Izq As Single, Arr As Single, Ancho As Single, Alto As Single
Application.DisplayAlerts = False
With Selection
Izq = .Left: Arr = .Top: Ancho = .Width: Alto = .Height: .CopyPicture
End With
With ActiveSheet.ChartObjects.Add(Izq, Arr, Ancho, Alto)
.Chart.Paste
.Chart.Export "J:\" & ActiveSheet.Name & ".jpg"
.Delete
End With
Application.DisplayAlerts = True
End Sub

1 respuesta

Respuesta
1

Te anexo la macro actualizada

Sub TomaFoto()
' Código para TOMAR FOTO
    ActiveSheet.Unprotect Password:="1"
    Application.DisplayAlerts = False
    On Error Resume Next
    Sheets("FOTO1").Activate
    Dim Izq As Single, Arr As Single, Ancho As Single, Alto As Single
    Application.DisplayAlerts = False
    With Selection
        Izq = .Left: Arr = .Top: Ancho = .Width: Alto = .Height: .CopyPicture
    End With
    nombre = ActiveSheet.Name & " " & Format(Now, "hh_mm_ss")
    With ActiveSheet.ChartObjects.Add(Izq, Arr, Ancho, Alto)
        .Chart.Paste
        .Chart.Export "J:\" & nombre & ".jpg"
        .Delete
    End With
    Application.DisplayAlerts = True
End Sub

sal u dos

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas