zuerst vielen Dank für die vielen Hilfen hier im Forum auf meine bisher gestellten Fragen, wirklich SUPER, DANKE !
Ich bitte um Hilfe zu folgendem Problem :
Ich schreibe in eine Textdatei die Zugriffe auf eine Exceldatei wie folgt :
in "DieseArbeitsmappe" steht :
Option Explicit
Private Sub Workbook_Open()
protocol
End Sub
im Modul mod_prot steht :
' Modul mod_prot
Option Explicit
' Variablen setzen
Public myApp As New cls_pro
Sub protocol()
Set myApp.App = Application
End Sub
Public Sub protocol1(BENUTZER As String, DATUM As String, _
UHRZEIT As String, DATEINAME As String, Modus As String)
Open "E:\_EIGENE\ZUGRIFFE.txt" For Append As #1
Print #1, BENUTZER & vbTab & DATUM & vbTab _
& UHRZEIT & vbTab & DATEINAME & vbTab; Modus
Close #1
End Sub
im Klassenmodul steht :
' Klassenmodul cls_pro
Option Explicit
' Variablen setzen
Public WithEvents App As Application
Private Sub App_WorkbookBeforeClose _
(ByVal Wb As Workbook, Cancel As Boolean)
protocol1 Application.UserName, Format(Now, "DD.MM.YYYY"), _
Format(Now, "HH:MM:SS"), Wb.FullName, "ENDE"
End Sub
Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
protocol1 Application.UserName, Format(Now, "DD.MM.YYYY"), _
Format(Now, "HH:MM:SS"), Wb.FullName, "START"
End Sub
damit werden in die Datei Zugriffe.txt alle Start und Ende geschrieben.
Nun möchte ich folgende Ausgabe der Msgbox aus dem Klassenmodul in die Textdatei z.B. aender. _
txt schreiben, die Ausgabe in einer Msgbox klappt, wie bekomme ich die Informationen der Msgbox _
in eine Textdatei. Msgbox wird wie folgt erstellt :
' Klassenmodul cls_pro
Option Explicit
' Variablen setzen
Public WithEvents App As Application
Private Sub App_WorkbookBeforeClose _
(ByVal Wb As Workbook, Cancel As Boolean)
protocol1 Application.UserName, Format(Now, "DD.MM.YYYY"), _
Format(Now, "HH:MM:SS"), Wb.FullName, "ENDE"
End Sub
Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
protocol1 Application.UserName, Format(Now, "DD.MM.YYYY"), _
Format(Now, "HH:MM:SS"), Wb.FullName, "START"
End Sub
Private Sub App_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
MsgBox "Zelle " & Target.Address(False, False) & _
" aus Blatt " & ActiveSheet.name & _
" aus Arbeitsmappe " & ActiveWorkbook.name & _
" " & vbCr & vbCr & _
" am " & Format(Now, "DD.MM.YYYY") & _
" um " & Format(Now, "HH:MM:SS") & vbCr & vbCr & _
" wurde von Benutzer " & Application.UserName & _
" geändert!", vbInformation, " ÄNDERUNG"
End Sub
Vielen Dank im Voraus für Eure Unterstützung.
Mfg Eric