Hirdetés

Új hozzászólás Aktív témák

  • Thrawnad

    senior tag

    Sziasztok!

    Van egy nyitott excel file, és szeretném elmenteni valamilyen néven mentéskor.
    Azaz backupot akarok csinálni.
    Illetve egy munkalapon mentem, hogy mikor ki mentett.
    Nagy része megvan:

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Sheets("Ment").Visible = True
    Sor_M = 2
    While Worksheets("Ment").Cells(Sor_M, 1) <> ""
    Sor_M = Sor_M + 1
    Wend
    Worksheets("Ment").Cells(Sor_M, 1) = Sor_M
    Worksheets("Ment").Cells(Sor_M, 2) = Date
    Worksheets("Ment").Cells(Sor_M, 3) = Time
    Worksheets("Ment").Cells(Sor_M, 4) = Environ("Username")

    If (Sor_M Mod 5) = 0 Then
    Prefix = "01_"
    End If
    If (Sor_M Mod 5) = 1 Then
    Prefix = "02_"
    End If
    If (Sor_M Mod 5) = 2 Then
    Prefix = "03_"
    End If
    If (Sor_M Mod 5) = 3 Then
    Prefix = "04_"
    End If
    If (Sor_M Mod 5) = 4 Then
    Prefix = "05_"
    End If

    Worksheets("Ment").Cells(Sor_M, 5) = Prefix

    Dim File_Old As String
    Dim File_New As String
    Dim File_Path As String


    File_Old = ActiveWorkbook.Name
    File_New = Prefix & File_Old
    File_Path = ActiveWorkbook.Path

    ' ÉS ide kellene valami ami elmenti a filet.


    Sheets("Ment").Visible = Fals

    Application.ScreenUpdating = True

    Application.Calculation = xlAutomatic


    End Sub

    Ebben kérek segítséget.

    Thrawnad

Új hozzászólás Aktív témák