Error number 48, error loading dll

tanfidzularus

New Member
Joined
Feb 15, 2014
Messages
1
I build a tools that copied from ron de bruin win tips and adjust it according to my need. https://www.rondebruin.nl/win/s1/outlook/saveatt.htm But after i changed my pc (before using win 7 and office 2007) and upgrade the os, it doesnt work any more. Now im using win 10 and office 2010 Especially script that "saving attachment" It keeps pop up and showing error no 48, error loading dll. I google it and not find any specific solution about my problem.
Code:
Sub SaveAttachments()

    Dim ns As Namespace
    Dim Inbox As MAPIFolder
    Dim SubFolder As MAPIFolder
    Dim Item As Object
    Dim Atmt As Attachment
    Dim Filename As String
    Dim MyDocPath As String
    Dim I As Integer
    Dim wsh As Object
    Dim fs As Object

On Error GoTo ThisMacro_err

    Set ns = GetNamespace("MAPI")
    Set Inbox = ns.GetDefaultFolder(olFolderInbox)
    Set SubFolder = Inbox.Folders("Delete")
    Set MyEmails = SubFolder.Items

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    I = 0
    If SubFolder.Items.Count = 0 Then
        MsgBox "Tidak ada email baru pada folder: " & SubFolder, vbInformation, "CDCM"
        Set SubFolder = Nothing
        Set Inbox = Nothing
        Set ns = Nothing
        Exit Sub
    End If

    If DestFolder = "" Then
        Set wsh = CreateObject("WScript.Shell")
        Set fs = CreateObject("Scripting.FileSystemObject")
        MyDocPath = ActiveWorkbook.path
        DestFolder = MyDocPath & "\Delete Collective"

        If Not fs.FolderExists(DestFolder) Then
            fs.CreateFolder DestFolder
        End If
    End If

    For Each Item In SubFolder.Items

    DoEvents
    If (Item.Class = olMail) And (Item.UnRead) = True Then
        For Each Atmt In Item.Attachments
            If Left(Atmt.Filename, 17) = "Delete Collective" And Right(Atmt.Filename, 4) = ".xls" Then
                Filename = DestFolder & Atmt.Filename
                Atmt.SaveAsFile Filename
                I = I + 1
            End If
        Next Atmt
    End If

    Item.UnRead = False

    Next Item

    If I > 0 Then
        MsgBox "Attachment sudah disimpan ", vbInformation, "CDCM"
    Else
        MsgBox "Attachment tidak ditemukan atau email sudah dibaca(Read)", vbInformation, "CDCM"
    End If
    MoveAgedMail

ThisMacro_exit:
    Set SubFolder = Nothing
    Set Inbox = Nothing
    Set ns = Nothing
    Set fs = Nothing
    Set wsh = Nothing
    Exit Sub

ThisMacro_err:
    MsgBox "Ups,an unexpected error has occurred." _
         & vbCrLf & "Please note and report the following information." _
         & vbCrLf & "Error Number: " & Err.Number _
         & vbCrLf & "Error Description: " & Err.Description, vbCritical, "Error!"
    Resume ThisMacro_exit

    With Application
    .ScreenUpdating = True
    .EnableEvents = True
    End With

End Sub
Hoping somebody could please gives advice
 
Last edited by a moderator:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top