ich verzweifele gerade ein bisschen.
bis dato hat der folgende Code perfekt funktioniert.
Wenn ich auf das Marko aktiviert habe, wurde für jedne Hersteller eine eigene .xlsx erstellt.
Seit gestern klappt es nicht mehr.
Kann mir jemand weiterhelfen?
Vielen Dank für die Unterstützung!
Sub export
ThisWorkbook.Sheets("template").Copy
Set wb = ActiveWorkbook
Set cop_temp_shet = wb.ActiveSheet
cop_temp_shet.Name = supplier
For Each shet In wb.Worksheets
If shet.Name supplier Then
shet.Delete
End If
Next shet
'copy info to template
cop_temp_shet.Range("D5").Value = supplier
cop_temp_shet.Range("D6").Value = full_name
cop_temp_shet.Range("D7").Value = tel
cop_temp_shet.Range("D8").Value = supp_email
cop_temp_shet.Range("I6").Value = supp_location
'insert log if exist
If supp_logo "" Then
With cop_temp_shet.Pictures.insert(supp_logo)
With .ShapeRange
.LockAspectRatio = msoFalse
.Width = 86.22858
.Height = 49.5674
End With
.Left = 575.9143
.Top = 5.14299
.Placement = 1
.PrintObject = True
End With
End If
'~~> Save the new workbook
export_day = Format(Now(), "mm/dd/yyyy")
export_day = Replace(export_day, "/", "_")
supp_path = export_folder & "\" & supplier & "_" & export_day & ".xlsx"
'lock the file name and remove buttons
cop_temp_shet.Shapes("insert_row").Delete
cop_temp_shet.Shapes("insert_column").Delete
cop_temp_shet.Shapes("delete_row").Delete
cop_temp_shet.Shapes("Export").Delete
cop_temp_shet.Shapes("update_quantity").Delete
'lock sheet
wb.Application.DisplayAlerts = False
cop_temp_shet.Select
If col_name_lock_status = True Then
p = 1
number_of_rows = cop_temp_shet.Cells(cop_temp_shet.Rows.Count, "B").End(xlUp).Row
For Each lock_col In lock_names
col_posit = cop_temp_shet.Rows(10).Find(what:=lock_col, LookIn:=xlValues, LookAt:= _
xlWhole).Column
title_lock = "locked_names_" & Str(p)
Set rng_lock = cop_temp_shet.Range(cop_temp_shet.Cells(12, col_posit), _
cop_temp_shet.Cells(number_of_rows, col_posit))
cop_temp_shet.Protection.AllowEditRanges.Add Title:=title_lock, Range:=rng_lock
p = p + 1
Next lock_col
cop_temp_shet.Protect Password:="test", DrawingObjects:=True, Contents:=True, Scenarios: _
=True
End If
wb.Application.DisplayAlerts = False
wb.SaveAs supp_path, FileFormat:=51
wb.Application.DisplayAlerts = True
wb.Close
End If
Next comp
MsgBox "Done!"
Application.ScreenUpdating = True
End If
End With
End Sub