ich habe folgendes Problem:
Application.VBE.ActiveVBProject.VBComponents.Item(5).CodeModule.InsertLines zaehler, text3
Wenn die obere Zeile in meinem Makro vorkommt(als Befehl, Kommentar geht ohne Probleme) und ich auf speichern gehe, dann greift mein AntiVirenScanner(F-Secure) ein und löscht die ganze Excel-Arbeitsmappe samt aller Makros.
Nun wollte ich fragen, ob man dies irgendwie umgehen kann, bzw dem Virenscanner irgendwie sagen das dies kein Makro-Virus ist.
hier ist mein gesamter Makro:
Private Sub bsOK_Click()
Dim txtPfad As String
Dim zaehler As Long
If Pfad.Text = "" Then
MsgBox ("Bitte Pfad eingeben bzw. auswählen !!!")
Exit Sub
End If
If ListBox.Text = "" Then
MsgBox ("Bitte Abteilung auswählen !!!")
Exit Sub
End If
Select Case ListBox.Text
Case "Elektronik"
CodeLine = 49
Case "Mechanik"
CodeLine = 54
Case "Sensorik"
CodeLine = 59
Case "PHC"
CodeLine = 64
Case "Data Group"
CodeLine = 69
End Select
txtPfad = Pfad.Text
Pos = InStr(1, txtPfad, "\", 1)
Do While Pos <> 0
Pos1 = Pos
Pos = InStr(Pos + 1, txtPfad, "\", 1)
Loop
Datei = Mid(txtPfad, Pos1 + 1, Len(txtPfad) - Pos1)
txtPfad = Left(txtPfad, Pos1) & "[" & Datei & "]"
Set codezeile = Application.VBE.ActiveVBProject.VBComponents
textabc = codezeile.Item(3).CodeModule.Lines(CodeLine, 1)
textdavor = Left(textabc, 48)
textabc = Mid(textabc, 49, (Len(textabc) - 49))
textabc = textabc & " + " & "'" & txtPfad & Chr(34) & " & works.Name & " & Chr(34) & "'!AH5"
codeneu = textdavor & textabc & Chr(34)
codezeile.Item(3).CodeModule.ReplaceLine CodeLine, codeneu 'ersetzen der Code-Zeile
text1 = codezeile.Item(5).CodeModule.Lines(9, 5)
zaehler = 10
Do While zaehler <> 0
text2 = codezeile.Item(5).CodeModule.Lines(zaehler, 1)
If Right(text2, 1) = ")" Then
Exit Do
Else
zaehler = zaehler + 1
End If
Loop
text2 = Left(text2, Len(text2) - 1) & ", _"
text3 = Space(20) & Chr(34) & Pfad.Text & Chr(34) & ")"
codezeile.Item(5).CodeModule.ReplaceLine zaehler, text2
zaehler = zaehler + 1
'text4 = Application.VBE.ActiveCodePane.CodeModule.Lines(71, 1)
'text4 = Right(text4, Len(text4) - 1)
'Application.VBE.ActiveCodePane.CodeModule.ReplaceLine 71, text4
Application.VBE.ActiveVBProject.VBComponents.Item(5).CodeModule.InsertLines zaehler, text3
'text5 = "'" & text4
'Application.VBE.ActiveCodePane.CodeModule.ReplaceLine 71, text5
MsgBox ("Benutzer erfolgreich hinzugefügt!!!")
End Sub
Ich danke euch schon mal
gruss
Steffen D