'check for files: For i = LBound(aFiles) To UBound(aFiles) If Dir(ThisWorkbook.Path & "\" & aFiles(i)) = vbNullString Then strError = strError & vbLf & "File not found: '" & aFiles(i) & "'." End If Next i
.Worksheets("DU Dashboard").Activate Sheet23.CreatePowerPoint End With
ErrHandler: If strError <> vbNullString Then frmError.lstError.Clear aError = Split(strError, vbLf) For i = LBound(aError) + 1 To UBound(aError) frmError.lstError.AddItem aError(i) Next i frmError.Show End If
With Application .DisplayAlerts = True .EnableEvents = True .ScreenUpdating = True End With
If Err.Number <> 0 Then MsgBox Err.Number & ": " & Err.Description End If End Sub
Attaching the workbook also for your easy reference...
Generally, scope should be kept as small as possible, so only code that needs to use it does so. If you code is never going to be called from outside the module/class/object in which it resides, then naming it private is fine. If you want to call it from somewhere else, then it needs to be public
Bookmarks