xlsvbah13.1

Attribute VB_Name = "mod1Oefeningen"

Option Explicit

Sub Oefening1()
    
    Dim wbWerkboek As Workbook
    Dim strBestand As String
    
    strBestand = ActiveWorkbook.Path & "\Bronnen\Werkmap 1.xlsx"
    
    Set wbWerkboek = Workbooks.Open(strBestand)
    
End Sub

Sub Oefening2()

    On Error GoTo FoutAfhandelaar

    Dim wbWerkboek As Workbook
    Dim strBestand As String
    
    strBestand = ActiveWorkbook.Path & "\Bronnen\Werkmap 4.xlsx"
    
    Set wbWerkboek = Workbooks.Open(strBestand)
    
    Exit Sub
    
FoutAfhandelaar:
    
    If Err.Number = 1004 Then
        MsgBox "Het bestand: " & strBestand & " is niet gevonden!", vbCritical
    End If

End Sub

Sub Oefening3()

    Dim wbWerkboek As Workbook
    Dim strBestand As String
    
    strBestand = ActiveWorkbook.Path & "\Bronnen\Werkmap 4.xlsx"
    
    If Dir(strBestand) = "" Then
        MsgBox "Het bestand: " & strBestand & " is niet gevonden!", vbCritical
    Else
        Set wbWerkboek = Workbooks.Open(strBestand)
    End If

End Sub


Download hier het bestand.