Hi folks,

I need your help, as I'm getting now a bit frustrated, as I do not recognize the issue.... Actually the code works fine in 90% of the cases, but for whatever reason for some users from one minute to another not... Means they used it without any problems, and then they getting an error.
As I know to copy a sheet it must be existing and visible... It is according to the code.
The Thisworkbook is also the active workbook in at foreground, due that the fact that the userform in this file starts the proccess.
Also the network drive is available according our network admins.
So what else can it be?


Thx you all!
Cheers
Artiszta

Sub dbeintrag_erstellen()

Dim int_a As Integer
Dim int_b As Integer
Dim str_Errorhandler As String
int_a = 1

On Error GoTo errorhandler

Application.DisplayAlerts = False
Application.ScreenUpdating = False
str_Dateiname(1) = "S:\SMS_" & TB_Krzl.Value & "\DB - " & CDate(TB_datum.Value) & " - " & CB_Projekt.Value & " - " & TB_Krzl.Value & " " & int_a & ".csv"

Do While Dir(str_Dateiname(1)) <> ""
    int_b = Len(str_Dateiname(1)) - Len(CStr(int_a)) - 4
    int_a = int_a + 1
    str_Dateiname(1) = Left(str_Dateiname(1), int_b) & int_a & ".csv"
Loop

ThisWorkbook.Worksheets("db").Visible = True
ThisWorkbook.Worksheets("db").Copy
ActiveSheet.Rows(1).Delete
ActiveWorkbook.SaveAs Filename:=str_Dateiname(1), FileFormat:=xlCSV, local:=True
ActiveWorkbook.Close
getback:
ThisWorkbook.Activate
ThisWorkbook.Worksheets("db").Visible = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Exit Sub
errorhandler:
str_Errorhandler = "Error #" & Err & " : " & Error(Err) & Chr(10) & "Datei: " & str_Dateiname(1)
 MsgBox str_Errorhandler, vbCritical, "Error"
GoTo getback

End Sub