Runtime error 48 file not found xlsaddin dll

Ошибка 48 может привести к сбоям в работе и зависанию компьютера, а также к потенциальному заражению вирусом. Узнайте, как быстро и легко исправить эти ошибки во время выполнения Microsoft Excel!
Icon Ex Номер ошибки: Ошибка 48
Название ошибки: Microsoft Excel Runtime Error 48
Описание ошибки: Ошибка 48: Возникла ошибка в приложении Microsoft Excel. Приложение будет закрыто. Приносим извинения за неудобства.
Разработчик: Microsoft Corporation
Программное обеспечение: Microsoft Excel
Относится к: Windows XP, Vista, 7, 8, 10, 11

Определение «Microsoft Excel Runtime Error 48»

Это наиболее распространенное условие «Microsoft Excel Runtime Error 48», известное как ошибка времени выполнения (ошибка). Чтобы убедиться, что функциональность и операции работают в пригодном для использования состоянии, разработчики программного обеспечения, такие как Microsoft Corporation, выполняют отладку перед выпусками программного обеспечения. Тем не менее, возможно, что иногда ошибки, такие как ошибка 48, не устранены, даже на этом этапе.

Пользователи Microsoft Excel могут столкнуться с ошибкой 48, вызванной нормальным использованием приложения, которое также может читать как «Microsoft Excel Runtime Error 48». Если происходит «Microsoft Excel Runtime Error 48», разработчикам будет сообщено об этой проблеме, хотя отчеты об ошибках встроены в приложение. Затем Microsoft Corporation будет иметь знания, чтобы исследовать, как и где устранить проблему. Поэтому, когда вы сталкиваетесь с запросом на обновление Microsoft Excel, это обычно связано с тем, что это решение для исправления ошибки 48 и других ошибок.

Почему возникает ошибка времени выполнения 48?

У вас будет сбой во время выполнения Microsoft Excel, если вы столкнетесь с «Microsoft Excel Runtime Error 48» во время выполнения. Причины сбоев обработки можно отличить, классифицируя ошибки 48 следующим образом:.

Ошибка 48 Crash — Ошибка 48 остановит компьютер от выполнения обычной программной операции. Это возникает, когда Microsoft Excel не работает должным образом или не знает, какой вывод будет подходящим.

Утечка памяти «Microsoft Excel Runtime Error 48» — если есть утечка памяти в Microsoft Excel, это может привести к тому, что ОС будет выглядеть вялой. Это может быть вызвано неправильной конфигурацией программного обеспечения Microsoft Corporation или когда одна команда запускает цикл, который не может быть завершен.

Ошибка 48 Logic Error — Вы можете столкнуться с логической ошибкой, когда программа дает неправильные результаты, даже если пользователь указывает правильное значение. Неисправный исходный код Microsoft Corporation может привести к этим проблемам с обработкой ввода.

Microsoft Excel Runtime Error 48 проблемы часто являются результатом отсутствия, удаления или случайного перемещения файла из исходного места установки Microsoft Excel. Большую часть проблем, связанных с данными файлами, можно решить посредством скачивания и установки последней версии файла Microsoft Corporation. В качестве дополнительного шага по устранению неполадок мы настоятельно рекомендуем очистить все пути к неверным файлам и ссылки на расширения файлов Microsoft Corporation, которые могут способствовать возникновению такого рода ошибок, связанных с Microsoft Excel Runtime Error 48.

Распространенные сообщения об ошибках в Microsoft Excel Runtime Error 48

Microsoft Excel Runtime Error 48 Проблемы, связанные с Microsoft Excel:

  • «Ошибка Microsoft Excel Runtime Error 48. «
  • «Недопустимая программа Win32: Microsoft Excel Runtime Error 48»
  • «Возникла ошибка в приложении Microsoft Excel Runtime Error 48. Приложение будет закрыто. Приносим извинения за неудобства.»
  • «Не удается найти Microsoft Excel Runtime Error 48»
  • «Microsoft Excel Runtime Error 48 не найден.»
  • «Ошибка запуска в приложении: Microsoft Excel Runtime Error 48. «
  • «Файл Microsoft Excel Runtime Error 48 не запущен.»
  • «Microsoft Excel Runtime Error 48 выйти. «
  • «Неверный путь к программе: Microsoft Excel Runtime Error 48. «

Ошибки Microsoft Excel Runtime Error 48 EXE возникают во время установки Microsoft Excel, при запуске приложений, связанных с Microsoft Excel Runtime Error 48 (Microsoft Excel), во время запуска или завершения работы или во время установки ОС Windows. Выделение при возникновении ошибок Microsoft Excel Runtime Error 48 имеет первостепенное значение для поиска причины проблем Microsoft Excel и сообщения о них вMicrosoft Corporation за помощью.

Источник ошибок Microsoft Excel Runtime Error 48

Проблемы Microsoft Excel Runtime Error 48 могут быть отнесены к поврежденным или отсутствующим файлам, содержащим ошибки записям реестра, связанным с Microsoft Excel Runtime Error 48, или к вирусам / вредоносному ПО.

Точнее, ошибки Microsoft Excel Runtime Error 48, созданные из:

  • Недопустимые разделы реестра Microsoft Excel Runtime Error 48/повреждены.
  • Зазаражение вредоносными программами повредил файл Microsoft Excel Runtime Error 48.
  • Другая программа злонамеренно или по ошибке удалила файлы, связанные с Microsoft Excel Runtime Error 48.
  • Другое программное обеспечение, конфликтующее с Microsoft Excel, Microsoft Excel Runtime Error 48 или общими ссылками.
  • Неполный или поврежденный Microsoft Excel (Microsoft Excel Runtime Error 48) из загрузки или установки.

Продукт Solvusoft

Загрузка
WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

  • Remove From My Forums
  • Question

  • User210110650 posted
    Hi Experts, I am using VB 6.0 and in my app I involk Excel. My app has been working fine for quite some time. Recently I got a runtime error ’48’ — «Error in loading DLL» when I try to involk the Excel. The stange thing is the same app involks Excel fine on
    other PCs. I think it’s some MS Office set up problems, but after I uninstall MS Office XP and reinstall MS Office XP, the error still exists. Can any one know what is the cause of problem and how to fix it ? Thank you in advance.

Answers

  • User1006193418 posted

    Hi Experts, I am using VB 6.0 and in my app I involk Excel. My app has been working fine for quite some time. Recently I got a runtime error ’48’ — «Error in loading DLL» when I try to involk the Excel.

    The stange thing is the same app involks Excel fine on other PCs. I think it’s some MS Office set up problems, but after I uninstall MS Office XP and reinstall MS Office XP, the error still exists. Can any one know what is the cause of problem and how to
    fix it ? Thank you in advance.

    Hi hemantkamb,

    Is there any more information displayed with the error message? As I know, The error ‘Error in loading DLL’ is often caused with a bad installation or an issue caused after another program has been installed that replaced the programs DLL. If
    there is any message telling what DLL file is missing, that will be more helpful to handle this problem.

    Since you have already done this step with Microsoft Office XP, it seems that the error DLL file is not raleted to the Office. Then, please try to remember is there any new programes installed or uninstalled with you computer before the issue shows
    up, especially those system programs. If so, try to recover them.

    In addition, reinstalling Visual Basic Studio 6.0 is also a suggestion to this situation.

    Best Regards,
    Shengqing Yang

    • Marked as answer by

      Thursday, October 7, 2021 12:00 AM

  • User1006193418 posted

    Yesterday my application has given me error for to open project that the file
    mscomctl not loading.

    Hi hemantkamb,

    Then, try to seaching the key word mscomctl in ‘My Computer’ to find is there any problem with the file
    mscomctl.

    I have got a result as the screen shot below:

    You may have a differen result from mine, but whatever you get, compare them with those computer which could run the application well. If there is any problem with the version in your computer, try to copy the correct version from another computer and
    to run the application again.

    [Idea]IMPORTANT NOTE: before you replace the version in your computer, do make sure you have a backup of those files!

    Best Regards,
    Shengqing Yang

    • Marked as answer by
      Anonymous
      Thursday, October 7, 2021 12:00 AM

Как исправить время выполнения Ошибка 48 Ошибка выполнения Microsoft Excel 48

В этой статье представлена ошибка с номером Ошибка 48, известная как Ошибка выполнения Microsoft Excel 48, описанная как Ошибка 48: Возникла ошибка в приложении Microsoft Excel. Приложение будет закрыто. Приносим свои извинения за неудобства.

О программе Runtime Ошибка 48

Время выполнения Ошибка 48 происходит, когда Microsoft Excel дает сбой или падает во время запуска, отсюда и название. Это не обязательно означает, что код был каким-то образом поврежден, просто он не сработал во время выполнения. Такая ошибка появляется на экране в виде раздражающего уведомления, если ее не устранить. Вот симптомы, причины и способы устранения проблемы.

Определения (Бета)

Здесь мы приводим некоторые определения слов, содержащихся в вашей ошибке, в попытке помочь вам понять вашу проблему. Эта работа продолжается, поэтому иногда мы можем неправильно определить слово, так что не стесняйтесь пропустить этот раздел!

  • Excel — только для вопросов о программировании с объектами или файлами Excel или разработке сложных формул
  • Runtime — Runtime — это время во время выполнения программы
  • Ошибка выполнения — ошибка выполнения обнаруживается после или во время выполнения программы.

Симптомы Ошибка 48 — Ошибка выполнения Microsoft Excel 48

Ошибки времени выполнения происходят без предупреждения. Сообщение об ошибке может появиться на экране при любом запуске %программы%. Фактически, сообщение об ошибке или другое диалоговое окно может появляться снова и снова, если не принять меры на ранней стадии.

Возможны случаи удаления файлов или появления новых файлов. Хотя этот симптом в основном связан с заражением вирусом, его можно отнести к симптомам ошибки времени выполнения, поскольку заражение вирусом является одной из причин ошибки времени выполнения. Пользователь также может столкнуться с внезапным падением скорости интернет-соединения, но, опять же, это не всегда так.

Fix Ошибка выполнения Microsoft Excel 48 (Error Ошибка 48)
(Только для примера)

Причины Ошибка выполнения Microsoft Excel 48 — Ошибка 48

При разработке программного обеспечения программисты составляют код, предвидя возникновение ошибок. Однако идеальных проектов не бывает, поскольку ошибки можно ожидать даже при самом лучшем дизайне программы. Глюки могут произойти во время выполнения программы, если определенная ошибка не была обнаружена и устранена во время проектирования и тестирования.

Ошибки во время выполнения обычно вызваны несовместимостью программ, запущенных в одно и то же время. Они также могут возникать из-за проблем с памятью, плохого графического драйвера или заражения вирусом. Каким бы ни был случай, проблему необходимо решить немедленно, чтобы избежать дальнейших проблем. Ниже приведены способы устранения ошибки.

Методы исправления

Ошибки времени выполнения могут быть раздражающими и постоянными, но это не совсем безнадежно, существует возможность ремонта. Вот способы сделать это.

Если метод ремонта вам подошел, пожалуйста, нажмите кнопку upvote слева от ответа, это позволит другим пользователям узнать, какой метод ремонта на данный момент работает лучше всего.

Обратите внимание: ни ErrorVault.com, ни его авторы не несут ответственности за результаты действий, предпринятых при использовании любого из методов ремонта, перечисленных на этой странице — вы выполняете эти шаги на свой страх и риск.

Метод 1 — Закройте конфликтующие программы

Когда вы получаете ошибку во время выполнения, имейте в виду, что это происходит из-за программ, которые конфликтуют друг с другом. Первое, что вы можете сделать, чтобы решить проблему, — это остановить эти конфликтующие программы.

  • Откройте диспетчер задач, одновременно нажав Ctrl-Alt-Del. Это позволит вам увидеть список запущенных в данный момент программ.
  • Перейдите на вкладку «Процессы» и остановите программы одну за другой, выделив каждую программу и нажав кнопку «Завершить процесс».
  • Вам нужно будет следить за тем, будет ли сообщение об ошибке появляться каждый раз при остановке процесса.
  • Как только вы определите, какая программа вызывает ошибку, вы можете перейти к следующему этапу устранения неполадок, переустановив приложение.

Метод 2 — Обновите / переустановите конфликтующие программы

Использование панели управления

  • В Windows 7 нажмите кнопку «Пуск», затем нажмите «Панель управления», затем «Удалить программу».
  • В Windows 8 нажмите кнопку «Пуск», затем прокрутите вниз и нажмите «Дополнительные настройки», затем нажмите «Панель управления»> «Удалить программу».
  • Для Windows 10 просто введите «Панель управления» в поле поиска и щелкните результат, затем нажмите «Удалить программу».
  • В разделе «Программы и компоненты» щелкните проблемную программу и нажмите «Обновить» или «Удалить».
  • Если вы выбрали обновление, вам просто нужно будет следовать подсказке, чтобы завершить процесс, однако, если вы выбрали «Удалить», вы будете следовать подсказке, чтобы удалить, а затем повторно загрузить или использовать установочный диск приложения для переустановки. программа.

Использование других методов

  • В Windows 7 список всех установленных программ можно найти, нажав кнопку «Пуск» и наведя указатель мыши на список, отображаемый на вкладке. Вы можете увидеть в этом списке утилиту для удаления программы. Вы можете продолжить и удалить с помощью утилит, доступных на этой вкладке.
  • В Windows 10 вы можете нажать «Пуск», затем «Настройка», а затем — «Приложения».
  • Прокрутите вниз, чтобы увидеть список приложений и функций, установленных на вашем компьютере.
  • Щелкните программу, которая вызывает ошибку времени выполнения, затем вы можете удалить ее или щелкнуть Дополнительные параметры, чтобы сбросить приложение.

Метод 3 — Обновите программу защиты от вирусов или загрузите и установите последнюю версию Центра обновления Windows.

Заражение вирусом, вызывающее ошибку выполнения на вашем компьютере, необходимо немедленно предотвратить, поместить в карантин или удалить. Убедитесь, что вы обновили свою антивирусную программу и выполнили тщательное сканирование компьютера или запустите Центр обновления Windows, чтобы получить последние определения вирусов и исправить их.

Метод 4 — Переустановите библиотеки времени выполнения

Вы можете получить сообщение об ошибке из-за обновления, такого как пакет MS Visual C ++, который может быть установлен неправильно или полностью. Что вы можете сделать, так это удалить текущий пакет и установить новую копию.

  • Удалите пакет, выбрав «Программы и компоненты», найдите и выделите распространяемый пакет Microsoft Visual C ++.
  • Нажмите «Удалить» в верхней части списка и, когда это будет сделано, перезагрузите компьютер.
  • Загрузите последний распространяемый пакет от Microsoft и установите его.

Метод 5 — Запустить очистку диска

Вы также можете столкнуться с ошибкой выполнения из-за очень нехватки свободного места на вашем компьютере.

  • Вам следует подумать о резервном копировании файлов и освобождении места на жестком диске.
  • Вы также можете очистить кеш и перезагрузить компьютер.
  • Вы также можете запустить очистку диска, открыть окно проводника и щелкнуть правой кнопкой мыши по основному каталогу (обычно это C :)
  • Щелкните «Свойства», а затем — «Очистка диска».

Метод 6 — Переустановите графический драйвер

Если ошибка связана с плохим графическим драйвером, вы можете сделать следующее:

  • Откройте диспетчер устройств и найдите драйвер видеокарты.
  • Щелкните правой кнопкой мыши драйвер видеокарты, затем нажмите «Удалить», затем перезагрузите компьютер.

Метод 7 — Ошибка выполнения, связанная с IE

Если полученная ошибка связана с Internet Explorer, вы можете сделать следующее:

  1. Сбросьте настройки браузера.
    • В Windows 7 вы можете нажать «Пуск», перейти в «Панель управления» и нажать «Свойства обозревателя» слева. Затем вы можете перейти на вкладку «Дополнительно» и нажать кнопку «Сброс».
    • Для Windows 8 и 10 вы можете нажать «Поиск» и ввести «Свойства обозревателя», затем перейти на вкладку «Дополнительно» и нажать «Сброс».
  2. Отключить отладку скриптов и уведомления об ошибках.
    • В том же окне «Свойства обозревателя» можно перейти на вкладку «Дополнительно» и найти пункт «Отключить отладку сценария».
    • Установите флажок в переключателе.
    • Одновременно снимите флажок «Отображать уведомление о каждой ошибке сценария», затем нажмите «Применить» и «ОК», затем перезагрузите компьютер.

Если эти быстрые исправления не работают, вы всегда можете сделать резервную копию файлов и запустить восстановление на вашем компьютере. Однако вы можете сделать это позже, когда перечисленные здесь решения не сработают.

Другие языки:

How to fix Error 48 (Microsoft Excel Runtime Error 48) — Error 48: Microsoft Excel has encountered a problem and needs to close. We are sorry for the inconvenience.
Wie beheben Fehler 48 (Microsoft Excel-Laufzeitfehler 48) — Fehler 48: Microsoft Excel hat ein Problem festgestellt und muss geschlossen werden. Wir entschuldigen uns für die Unannehmlichkeiten.
Come fissare Errore 48 (Errore di runtime di Microsoft Excel 48) — Errore 48: Microsoft Excel ha riscontrato un problema e deve essere chiuso. Ci scusiamo per l’inconveniente.
Hoe maak je Fout 48 (Microsoft Excel Runtime-fout 48) — Fout 48: Microsoft Excel heeft een probleem ondervonden en moet worden afgesloten. Excuses voor het ongemak.
Comment réparer Erreur 48 (Erreur d’exécution Microsoft Excel 48) — Erreur 48 : Microsoft Excel a rencontré un problème et doit se fermer. Nous sommes désolés du dérangement.
어떻게 고치는 지 오류 48 (Microsoft Excel 런타임 오류 48) — 오류 48: Microsoft Excel에 문제가 발생해 닫아야 합니다. 불편을 드려 죄송합니다.
Como corrigir o Erro 48 (Erro de tempo de execução 48 do Microsoft Excel) — Erro 48: O Microsoft Excel encontrou um problema e precisa fechar. Lamentamos o inconveniente.
Hur man åtgärdar Fel 48 (Microsoft Excel Runtime Error 48) — Fel 48: Microsoft Excel har stött på ett problem och måste avslutas. Vi är ledsna för besväret.
Jak naprawić Błąd 48 (Błąd wykonawczy programu Microsoft Excel 48) — Błąd 48: Microsoft Excel napotkał problem i musi zostać zamknięty. Przepraszamy za niedogodności.
Cómo arreglar Error 48 (Error 48 en tiempo de ejecución de Microsoft Excel) — Error 48: Microsoft Excel ha detectado un problema y debe cerrarse. Lamentamos las molestias.

The Author Об авторе: Фил Харт является участником сообщества Microsoft с 2010 года. С текущим количеством баллов более 100 000 он внес более 3000 ответов на форумах Microsoft Support и создал почти 200 новых справочных статей в Technet Wiki.

Следуйте за нами: Facebook Youtube Twitter

Рекомендуемый инструмент для ремонта:

Этот инструмент восстановления может устранить такие распространенные проблемы компьютера, как синие экраны, сбои и замораживание, отсутствующие DLL-файлы, а также устранить повреждения от вредоносных программ/вирусов и многое другое путем замены поврежденных и отсутствующих системных файлов.

ШАГ 1:

Нажмите здесь, чтобы скачать и установите средство восстановления Windows.

ШАГ 2:

Нажмите на Start Scan и позвольте ему проанализировать ваше устройство.

ШАГ 3:

Нажмите на Repair All, чтобы устранить все обнаруженные проблемы.

СКАЧАТЬ СЕЙЧАС

Совместимость

Требования

1 Ghz CPU, 512 MB RAM, 40 GB HDD
Эта загрузка предлагает неограниченное бесплатное сканирование ПК с Windows. Полное восстановление системы начинается от $19,95.

ID статьи: ACX07552RU

Применяется к: Windows 10, Windows 8.1, Windows 7, Windows Vista, Windows XP, Windows 2000

  • Home
  • VBForums
  • Visual Basic
  • Office Development
  • Run-time error ’48’ Error in loading DLL

  1. May 14th, 2019, 07:51 AM


    #1

    robycuccu is offline

    Thread Starter


    Junior Member


    Run-time error ’48’ Error in loading DLL

    Hi all,

    this is my first post and I hope that somebody can help me. My situation is this:

    O.S.: Win 7 Enterprise SP1 64 bit
    Office 2010 Pro Plus SP2 14.0.7015.10 R01

    I’m tring to execute this macro that reads all the messages into a particular subfolder of inbox folder of Outlook, it download all the attachments into a specific folder on my system and then it opens a new excel putting into its all the information about sender, reciever, email sender, email receiver etc:

    Code:

    Sub ImportareMessaggi()
        
        Dim XL As Excel.Application
        Dim WB As Excel.Workbook
        
        Set MioOutlook = CreateObject("Outlook.Application")
        Set MioMapi = MioOutlook.GetNamespace("MAPI")
    
        Set XL = New Excel.Application
        Set WB = XL.Workbooks.Open(Sheets("Foglio1").Range("A10").Value)
        
        If Sheets("Foglio1").Range("A4").Value = "1" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderInbox)
        ElseIf Sheets("Foglio1").Range("A4").Value = "2" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderSentMail)
        ElseIf Sheets("Foglio1").Range("A4").Value = "3" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderDeletedItems)
        ElseIf Sheets("Foglio1").Range("A4").Value = "4" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderJunk)
        ElseIf Sheets("Foglio1").Range("A4").Value = "5" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderOutbox)
        End If
        If Sheets("Foglio1").Range("A2").Value = "" Then
            Set Myfolder = Defaultfolder
        Else
            Set Myfolder = Defaultfolder.Folders(Sheets("Foglio1").Range("A2").Value)
        End If
        
        'Cerca prima cella libera
        x = 0
        Do
            x = x + 1
        Loop Until WB.Sheets("Foglio1").Cells(x, 1) = ""
        
        'Imposta data/ora massima
        If WB.Sheets("Foglio1").Cells(2, 1) > "" Then
            MaxDate = CStr(WB.Sheets("Foglio1").Cells(2, 1))
            lung = Len(MaxDate)
            Pos = InStr(MaxDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & Right(MaxDate, Pos)
            Else
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & " 0" & Right(MaxDate, Pos - 1)
            End If
        Else
            MaxDate = ""
        End If
           
        On Error GoTo SaltaMail
        
        For Each obj In Myfolder.Items
            
            SrcDate = CStr(obj.ReceivedTime)
            
            lung = Len(SrcDate)
            Pos = InStr(SrcDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & Right(SrcDate, Pos)
            Else
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & " 0" & Right(SrcDate, Pos - 1)
            End If
            
            If SrcDate > MaxDate Then
                If Sheets("Foglio1").Range("A8").Value = "" Or Sheets("Foglio1").Range("A8").Value = obj.SenderEmailAddress Then
                    WB.Sheets("Foglio1").Cells(x, 1) = obj.ReceivedTime
                    WB.Sheets("Foglio1").Cells(x, 2) = obj.Subject
                    WB.Sheets("Foglio1").Cells(x, 3) = obj.Body
                    WB.Sheets("Foglio1").Cells(x, 4) = obj.To
                    WB.Sheets("Foglio1").Cells(x, 5) = obj.CC
                    WB.Sheets("Foglio1").Cells(x, 6) = obj.BCC
                    WB.Sheets("Foglio1").Cells(x, 7) = obj.ReceivedByName
                    WB.Sheets("Foglio1").Cells(x, 8) = obj.SenderName
                    WB.Sheets("Foglio1").Cells(x, 9) = obj.SenderEmailAddress
                    If obj.Attachments.Count > 0 Then
                        For i = 1 To obj.Attachments.Count
                            obj.Attachments(i).SaveAsFile (Sheets("Foglio1").Range("A6").Value & "" & obj.Attachments(i).Filename)
                        Next
                    End If
                    x = x + 1
                End If
            End If
            
    SaltaMail:
    
        Next
        
        On Error GoTo 0
        
        WB.Close
    
    End Sub

    raised by a classic button, but when I click on button I get a popup with the message indicated into the title of this post, and the debug highlights the line in yellow.
    I have check also all the references and there aren’t any dlls missed…the following are all the references:

    Visual Basic for Applications
    Microsoft Excel 14.0 Object Library
    OLE Automation
    Microsoft Outlook 14.0 Object Library

    Please, can somebody help me to resolve this problem?

    Many thanks


  2. May 14th, 2019, 04:20 PM


    #2

    Re: Run-time error ’48’ Error in loading DLL

    are you doing this code in excel?

    while i can see some problem in your code i can not see why a new instance of excel should not be created, i tested with a basic code to be sure

    do you really need a new instance of excel? you can just open the additionally required workbook in the same instance, should be quicker and use less resources, especially as you would currently be leaving the new instance hanging open

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  3. May 15th, 2019, 12:59 AM


    #3

    robycuccu is offline

    Thread Starter


    Junior Member


    Talking Re: Run-time error ’48’ Error in loading DLL

    Yes, exact I’m doing this code in excel…a new instance of excel is a request of my boss ..I’m agree with you that is not necessary.
    Anyway the idea is everytime that I click on the button, the second file should open and it should update itself with all the email received.

    Do you have find out any error in the code? Please, can you tell me why I obtain this error?

    Many thanks


  4. May 15th, 2019, 04:35 AM


    #4

    Re: Run-time error ’48’ Error in loading DLL

    i retested in office 2010 windows 10

    Code:

    Sub tinst()
    Dim xl As Excel.Application
    Set xl = New Excel.Application
    xl.Visible = True
    xl.Quit
    Set xl = Nothing
    End Sub

    ran without error, opened a new instance of excel, i had a break point before quit, so i could see the new instance

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  5. May 15th, 2019, 08:09 AM


    #5

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    Name:  Parameters.jpg
Views: 5714
Size:  51.7 KB

    unfortunately I can’t attach my xml file, but I attached a screenshoot of the xml that contains the button.
    I’ve try your code and on my machine ran without error, but your code is differente from mine and if I add the rest of the my code I obtain the same error…
    and I don’t find what’s the problem…


  6. May 15th, 2019, 08:30 AM


    #6

    Re: Run-time error ’48’ Error in loading DLL

    Hmm, the only thing fishy then is the next line after your red line in Post#1, because if i’m reading it right you’re trying to load an «xlsm»-File, which contains (probably) VBA.
    Not sure if you have Macros enabled with/without confirmation, and you run afoul on that.
    Nevermind, that the file should exist beforehand (not sure what error-message you’d get in case of not-existing-file)

    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ——————————————————————————————————————————————————————————————————————————————-

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ———————————————————————————
    People call me crazy because i’m jumping out of perfectly fine airplanes.
    ———————————————————————————
    Code is like a joke: If you have to explain it, it’s bad


  7. May 15th, 2019, 09:40 AM


    #7

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    Exact … the code of the macro that I’ve put in the first post is contained in a file (the screenshoot is related to this xlsm file), and when I click on the button should open another file (where the name is indicated in A10 cell) where every row of this file contains all the details (sender, receiver, subject etc ..) Into the A6 cell instead, is indicated the folder where the attachments of the email are stored.
    I have Macros enabled without confirmation.

    Last edited by robycuccu; May 15th, 2019 at 09:45 AM.

    Reason: Add a further indication


  8. May 15th, 2019, 04:18 PM


    #8

    Re: Run-time error ’48’ Error in loading DLL

    as the error is before trying to open the file and you are getting an error not just the code hanging as if excel is locked by a dialog or similar

    all you can do is try some of the following

    in a new workbook
    try a basic code, as i posted above, try same code on another computer, if either of those work (which it does for me), try reinstalling office or upgrading windows version

    alternatively try running your code opening the file in the same instance of word and present the options to management

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  9. May 16th, 2019, 02:22 AM


    #9

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    The machine where I’m running this macro/code is a work laptop, where unfortunately I can’t try reinstalling office or upgrading windows version
    because all the updates of the system are scheduled.
    I’ve create a new Excel file and then I go into Developer menu and click on Visual Basic button and then I create a new module
    that contains your code and run it, I obtain the same error.
    Why?


  10. May 16th, 2019, 04:08 AM


    #10

    Re: Run-time error ’48’ Error in loading DLL

    You could try the latebound version

    Dim XL As Object
    Set XL=CreateObject(«Excel.Application»)

    See if the error still comes up

    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ——————————————————————————————————————————————————————————————————————————————-

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ———————————————————————————
    People call me crazy because i’m jumping out of perfectly fine airplanes.
    ———————————————————————————
    Code is like a joke: If you have to explain it, it’s bad


  11. May 16th, 2019, 04:48 AM


    #11

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    Quote Originally Posted by Zvoni
    View Post

    You could try the latebound version

    Dim XL As Object
    Set XL=CreateObject(«Excel.Application»)

    See if the error still comes up

    With early binding I obtain Run-time error ’48’ on the line:

    Code:

    Set XL = New Excel.Application

    With late binding I obtain Run-time error ’48’ on the line:

    Code:

    Set WB = XL.Workbooks.Open(Sheets("Foglio1").Range("A10").Value)

    So, the error is the same but the row where the error occur is different…


  12. May 16th, 2019, 07:51 AM


    #12

    Re: Run-time error ’48’ Error in loading DLL

    Hmm, OK, my research turned up, that there must be a reference missing (and it doesn’t has anything to do with your code per se).
    By any chance: Did you start coding this on another Computer (Different Office-Version/Bitness)?

    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ——————————————————————————————————————————————————————————————————————————————-

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ———————————————————————————
    People call me crazy because i’m jumping out of perfectly fine airplanes.
    ———————————————————————————
    Code is like a joke: If you have to explain it, it’s bad


  13. May 16th, 2019, 11:58 AM


    #13

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    I tried to run your code on this machine:

    O.S.: Win 8.1 Enterprise 64 bit
    Microsoft Office 365 ProPlus

    and it is run without any problem.

    My code instead, after that I click on button keep the sheet freezed and after some minutes I obtain the message «Wait. Another application was completing an OLE action» (see the attach) Name:  Popup.jpg
Views: 5276
Size:  10.1 KB.


  14. May 16th, 2019, 12:17 PM


    #14

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    I tried to run your code on this machine:

    O.S.: Win 8.1 Enterprise 64 bit
    Microsoft Office 365 ProPlus

    and it is run without any problem.

    My code instead, after that I click on button keep the sheet freezed and after some minutes I obtain the message «Wait. Another application was completing an OLE action» (see the attach) Name:  Popup.jpg
Views: 5276
Size:  10.1 KB.[/QUOTE].
    The strange thing si that if I check into the target folder, there are all the attachment of the emails of the subfolder of outlook, but the other excel file doesn’t updated with a new row with the data of the email read.

    Moreover, I tried to run your code on this machine:

    O.S.: Win 10 Home 64 bit
    Microsoft Office Pro Plus 2016

    and also on this machine it is run without any problem.
    My code instead, indicate me that Microsoft Outlook 16.0 Object Library is missed and that there’s any other version. I’ve tried also with late binding but at this row:

    Set MioOutlook = CreateObject(«Outlook.Application»)

    I obtain the message «Run-time error ‘429’: the ActiveX component can’t enable to create the object.

    Last edited by robycuccu; May 16th, 2019 at 12:45 PM.


  15. May 16th, 2019, 12:35 PM


    #15

    Re: Run-time error ’48’ Error in loading DLL

    And that’s probably the Problem. You create a Macro on Machine 1 (with Office Version 2), and then you try to run it on Machine 2 (with Office Version 1). Kaboom

    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ——————————————————————————————————————————————————————————————————————————————-

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ———————————————————————————
    People call me crazy because i’m jumping out of perfectly fine airplanes.
    ———————————————————————————
    Code is like a joke: If you have to explain it, it’s bad


  16. May 16th, 2019, 12:51 PM


    #16

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    What’s between these versions:

    Office 2010 Pro Plus SP2 14.0.7015.10 R01
    Microsoft Office 365 ProPlus
    Microsoft Office Pro Plus 2016

    Machine 1 and Machine 2?

    In all these tests I’ve always follow the procedure:

    I’ve create a new Excel file and then I go into Developer menu and click on Visual Basic button and then I create a new module pasting or your code or mine.

    So there ins’t a solution for this problem?


  17. May 16th, 2019, 01:23 PM


    #17

    Re: Run-time error ’48’ Error in loading DLL

    Microsoft Office has 2003, 2007, 2010, 2013, 2016, and 2019 versions, so Office 2010 is different than 2016.

    Office 365 could actually be Office 2013, 2016, or 2019.

    The solution is to use late binding to avoid the issue.


  18. May 16th, 2019, 03:59 PM


    #18

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    In my case under Office 365 should be Office 2013…I have already use late binding and I obtained the message that I have report in the post #11


  19. May 16th, 2019, 04:28 PM


    #19

    Re: Run-time error ’48’ Error in loading DLL

    Microsoft Office has 2003, 2007, 2010, 2013, 2016, and 2019 versions, so Office 2010 is different than 2016.

    the reference is always correct with what he is doing

    I’ve create a new Excel file and then I go into Developer menu and click on Visual Basic button and then I create a new module pasting or your code or mine.

    i would generally always use late binding, but in this case it should not matter

    there is obviously a problem with the particular machine, apply for a replacement to be able to complete the task

    from http://support.legacyfamilytree.com/…ading-DLL.html

    Error 48: This error means one of the installation files is missing or the system registry has been corrupted. There is more than one trigger for this error. Here are the most common ones: The DLL or referenced DLL is not in a directory specified in the path.

    a quick google on excel error 48 bought up many hits, including suggestions to repair you excel installation

    edit: unlike excel, outlook needs to be running for createobject to work

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  20. May 17th, 2019, 12:56 AM


    #20

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    I’ve tried to use late binding and now I obtain this error:

    Run-time error ‘5’:

    Invalid procedure call or argument

    Code:

    Sub bottone()
        'Dim XL As Excel.Application
        'Dim WB As Excel.Workbook
        Dim XL As Object
        Dim WB As Object
        
        Set MioOutlook = CreateObject("Outlook.Application")
        Set MioMapi = MioOutlook.GetNamespace("MAPI")
    
        'Set XL = New Excel.Application
        Set XL = CreateObject("Excel.Application")
        Set WB = XL.Workbooks.Open(Sheets("Sheet1").Range("A10").Value)
        
        
        If Sheets("Sheet1").Range("A4").Value = "1" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderInbox)
        ElseIf Sheets("Sheet1").Range("A4").Value = "2" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderSentMail)
        ElseIf Sheets("Sheet1").Range("A4").Value = "3" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderDeletedItems)
        ElseIf Sheets("Sheet1").Range("A4").Value = "4" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderJunk)
        ElseIf Sheets("Sheet1").Range("A4").Value = "5" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderOutbox)
        End If
        If Sheets("Sheet1").Range("A2").Value = "" Then
            Set Myfolder = Defaultfolder
        Else
            Set Myfolder = Defaultfolder.Folders(Sheets("Sheet1").Range("A2").Value)
        End If
        
        'Cerca prima cella libera
        x = 0
        Do
            x = x + 1
        Loop Until WB.Sheets("Sheet1").Cells(x, 1) = ""
        
        'Imposta data/ora massima
        If WB.Sheets("Sheet1").Cells(2, 1) > "" Then
            MaxDate = CStr(WB.Sheets("Sheet1").Cells(2, 1))
            lung = Len(MaxDate)
            Pos = InStr(MaxDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & Right(MaxDate, Pos)
            Else
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & " 0" & Right(MaxDate, Pos - 1)
            End If
        Else
            MaxDate = ""
        End If
           
        On Error GoTo SaltaMail
        
        For Each obj In Myfolder.Items
            
            SrcDate = CStr(obj.ReceivedTime)
            
            lung = Len(SrcDate)
            Pos = InStr(SrcDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & Right(SrcDate, Pos)
            Else
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & " 0" & Right(SrcDate, Pos - 1)
            End If
            
            If SrcDate > MaxDate Then
                If Sheets("Sheet1").Range("A8").Value = "" Or Sheets("Sheet1").Range("A8").Value = obj.SenderEmailAddress Then
                    WB.Sheets("Sheet1").Cells(x, 1) = obj.ReceivedTime
                    WB.Sheets("Sheet1").Cells(x, 2) = obj.Subject
                    WB.Sheets("Sheet1").Cells(x, 3) = obj.Body
                    WB.Sheets("Sheet1").Cells(x, 4) = obj.To
                    WB.Sheets("Sheet1").Cells(x, 5) = obj.CC
                    WB.Sheets("Sheet1").Cells(x, 6) = obj.BCC
                    WB.Sheets("Sheet1").Cells(x, 7) = obj.ReceivedByName
                    WB.Sheets("Sheet1").Cells(x, 8) = obj.SenderName
                    WB.Sheets("Sheet1").Cells(x, 9) = obj.SenderEmailAddress
                    If obj.Attachments.Count > 0 Then
                        For i = 1 To obj.Attachments.Count
                            obj.Attachments(i).SaveAsFile (Sheets("Sheet1").Range("A6").Value & "" & obj.Attachments(i).Filename)
                        Next
                    End If
                    x = x + 1
                End If
            End If
            
    SaltaMail:
    
        Next
        
        On Error GoTo 0
        
        WB.Close
    
    End Sub

    Actually with late binding the error is moving toward, but why I obtain this new error? The code (a part the declaration of some variables with late binding) is the same…

    Last edited by robycuccu; May 17th, 2019 at 01:19 AM.


  21. May 17th, 2019, 06:15 AM


    #21

    Re: Run-time error ’48’ Error in loading DLL

    you should check if the outlook constant (olfolderinbox) has any value in the current context should be = 6

    this will of course also appy to any other outlook constants

    can you really read that yellow text?

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  22. May 17th, 2019, 06:21 AM


    #22

    Re: Run-time error ’48’ Error in loading DLL

    You are referring to a Sheets object which has not been declared.

    Code:

    Sub bottone()
        'Dim XL As Excel.Application
        'Dim WB As Excel.Workbook
        Dim XL As Object
        Dim WB As Object
        
        Set MioOutlook = CreateObject("Outlook.Application")
        Set MioMapi = MioOutlook.GetNamespace("MAPI")
    
        'Set XL = New Excel.Application
        Set XL = CreateObject("Excel.Application")
        Set WB = XL.Workbooks.Open(Sheets("Sheet1").Range("A10").Value)
        
        
        If Sheets("Sheet1").Range("A4").Value = "1" Then

    Just use WB.Sheets() like in the rest of your code


  23. May 17th, 2019, 06:31 AM


    #23

    Re: Run-time error ’48’ Error in loading DLL

    Sheets object which has not been declared

    i would guess that sheet1 is in the workbook containing the code, rather than the workbook that was opened, while i believe it would be better use a more fully qualified range, it should still work correctly

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  24. May 17th, 2019, 06:57 AM


    #24

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    Quote Originally Posted by westconn1
    View Post

    you should check if the outlook constant (olfolderinbox) has any value in the current context should be = 6

    this will of course also appy to any other outlook constants

    can you really read that yellow text?

    Sorry I’ve used the yellow text but the row not is visible…anyway the row is the follow:

    Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderInbox)

    How/Where can I found the outlook constant?


  25. May 17th, 2019, 07:03 AM


    #25

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    Quote Originally Posted by westconn1
    View Post

    i would guess that sheet1 is in the workbook containing the code, rather than the workbook that was opened, while i believe it would be better use a more fully qualified range, it should still work correctly

    Yes exactly, the sheet1 should refer to that is in the workbook containing the code…how can I refer to sheet1 contains in the workbook containing the code correctly?


  26. May 17th, 2019, 07:05 AM


    #26

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    Quote Originally Posted by westconn1
    View Post

    i would guess that sheet1 is in the workbook containing the code, rather than the workbook that was opened, while i believe it would be better use a more fully qualified range, it should still work correctly

    Yes exactly, the sheet1 should refer to that is in the workbook containing the code…how can I refer to sheet1 contains in the workbook containing the code correctly?


  27. May 17th, 2019, 07:16 AM


    #27

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    I’ve tried to modify the entire code in this way:

    Code:

    Sub bottone()
        'Dim XL As Excel.Application
        'Dim WB As Excel.Workbook
        Dim XL As Object
        Dim WB As Object
        Dim MioMapi As Object
        Dim Myfolder As Object
        
        Set MioOutlook = CreateObject("Outlook.Application")
        Set MioMapi = MioOutlook.GetNamespace("MAPI")
    
        'Set XL = New Excel.Application
        Set XL = CreateObject("Excel.Application")
        Set actualWB = XL.Workbooks.Open(Sheets("Sheet1").Range("A10").Value)
        
        
        If actualWB.Sheets("Sheet1").Range("A4").Value = "1" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderInbox)
        ElseIf actualWB.Sheets("Sheet1").Range("A4").Value = "2" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderSentMail)
        ElseIf actualWB.Sheets("Sheet1").Range("A4").Value = "3" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderDeletedItems)
        ElseIf actualWB.Sheets("Sheet1").Range("A4").Value = "4" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderJunk)
        ElseIf actualWB.Sheets("Sheet1").Range("A4").Value = "5" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderOutbox)
        End If
        If actualWB.Sheets("Sheet1").Range("A4").Value = "" Then
            Set Myfolder = Defaultfolder
        Else
            Set Myfolder = Defaultfolder.Folders(Sheets("Sheet1").Range("A2").Value)
        End If
        
        'Cerca prima cella libera
        x = 0
        Do
            x = x + 1
        Loop Until newWB.Sheets("Sheet1").Cells(x, 1) = ""
        
        'Imposta data/ora massima
        If newWB.Sheets("Sheet1").Cells(2, 1) > "" Then
            MaxDate = CStr(newWB.Sheets("Sheet1").Cells(2, 1))
            lung = Len(MaxDate)
            Pos = InStr(MaxDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & Right(MaxDate, Pos)
            Else
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & " 0" & Right(MaxDate, Pos - 1)
            End If
        Else
            MaxDate = ""
        End If
           
        On Error GoTo SaltaMail
        
        For Each obj In Myfolder.Items
            
            SrcDate = CStr(obj.ReceivedTime)
            
            lung = Len(SrcDate)
            Pos = InStr(SrcDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & Right(SrcDate, Pos)
            Else
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & " 0" & Right(SrcDate, Pos - 1)
            End If
            
            If SrcDate > MaxDate Then
                If actualWB.Sheets("Sheet1").Range("A8").Value = "" Or actualWB.Sheets("Sheet1").Range("A8").Value = obj.SenderEmailAddress Then
                    newWB.Sheets("Sheet1").Cells(x, 1) = obj.ReceivedTime
                    newWB.Sheets("Sheet1").Cells(x, 2) = obj.Subject
                    newWB.Sheets("Sheet1").Cells(x, 3) = obj.Body
                    newWB.Sheets("Sheet1").Cells(x, 4) = obj.To
                    newWB.Sheets("Sheet1").Cells(x, 5) = obj.CC
                    newWB.Sheets("Sheet1").Cells(x, 6) = obj.BCC
                    newWB.Sheets("Sheet1").Cells(x, 7) = obj.ReceivedByName
                    newWB.Sheets("Sheet1").Cells(x, 8) = obj.SenderName
                    newWB.Sheets("Sheet1").Cells(x, 9) = obj.SenderEmailAddress
                    If obj.Attachments.Count > 0 Then
                        For i = 1 To obj.Attachments.Count
                            obj.Attachments(i).SaveAsFile (actualWB.Sheets("Sheet1").Range("A6").Value & "" & obj.Attachments(i).Filename)
                        Next
                    End If
                    x = x + 1
                End If
            End If
            
    SaltaMail:
    
        Next
        
        On Error GoTo 0
        
        newWB.Close
    End Sub

    Now the error is changed and it’s throw by the row in red color.
    This is the new error shown:


  28. May 17th, 2019, 07:17 AM


    #28

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    I’ve tried to modify the entire code in this way:

    Code:

    Sub bottone()
        'Dim XL As Excel.Application
        'Dim WB As Excel.Workbook
        Dim XL As Object
        Dim WB As Object
        Dim MioMapi As Object
        Dim Myfolder As Object
        
        Set MioOutlook = CreateObject("Outlook.Application")
        Set MioMapi = MioOutlook.GetNamespace("MAPI")
    
        'Set XL = New Excel.Application
        Set XL = CreateObject("Excel.Application")
        Set actualWB = XL.Workbooks.Open(Sheets("Sheet1").Range("A10").Value)
        
        
        If actualWB.Sheets("Sheet1").Range("A4").Value = "1" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderInbox)
        ElseIf actualWB.Sheets("Sheet1").Range("A4").Value = "2" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderSentMail)
        ElseIf actualWB.Sheets("Sheet1").Range("A4").Value = "3" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderDeletedItems)
        ElseIf actualWB.Sheets("Sheet1").Range("A4").Value = "4" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderJunk)
        ElseIf actualWB.Sheets("Sheet1").Range("A4").Value = "5" Then
            Set Defaultfolder = MioMapi.GetDefaultFolder(olFolderOutbox)
        End If
        If actualWB.Sheets("Sheet1").Range("A4").Value = "" Then
            Set Myfolder = Defaultfolder
        Else
            Set Myfolder = Defaultfolder.Folders(Sheets("Sheet1").Range("A2").Value)
        End If
        
        'Cerca prima cella libera
        x = 0
        Do
            x = x + 1
        Loop Until newWB.Sheets("Sheet1").Cells(x, 1) = ""
        
        'Imposta data/ora massima
        If newWB.Sheets("Sheet1").Cells(2, 1) > "" Then
            MaxDate = CStr(newWB.Sheets("Sheet1").Cells(2, 1))
            lung = Len(MaxDate)
            Pos = InStr(MaxDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & Right(MaxDate, Pos)
            Else
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & " 0" & Right(MaxDate, Pos - 1)
            End If
        Else
            MaxDate = ""
        End If
           
        On Error GoTo SaltaMail
        
        For Each obj In Myfolder.Items
            
            SrcDate = CStr(obj.ReceivedTime)
            
            lung = Len(SrcDate)
            Pos = InStr(SrcDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & Right(SrcDate, Pos)
            Else
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & " 0" & Right(SrcDate, Pos - 1)
            End If
            
            If SrcDate > MaxDate Then
                If actualWB.Sheets("Sheet1").Range("A8").Value = "" Or actualWB.Sheets("Sheet1").Range("A8").Value = obj.SenderEmailAddress Then
                    newWB.Sheets("Sheet1").Cells(x, 1) = obj.ReceivedTime
                    newWB.Sheets("Sheet1").Cells(x, 2) = obj.Subject
                    newWB.Sheets("Sheet1").Cells(x, 3) = obj.Body
                    newWB.Sheets("Sheet1").Cells(x, 4) = obj.To
                    newWB.Sheets("Sheet1").Cells(x, 5) = obj.CC
                    newWB.Sheets("Sheet1").Cells(x, 6) = obj.BCC
                    newWB.Sheets("Sheet1").Cells(x, 7) = obj.ReceivedByName
                    newWB.Sheets("Sheet1").Cells(x, 8) = obj.SenderName
                    newWB.Sheets("Sheet1").Cells(x, 9) = obj.SenderEmailAddress
                    If obj.Attachments.Count > 0 Then
                        For i = 1 To obj.Attachments.Count
                            obj.Attachments(i).SaveAsFile (actualWB.Sheets("Sheet1").Range("A6").Value & "" & obj.Attachments(i).Filename)
                        Next
                    End If
                    x = x + 1
                End If
            End If
            
    SaltaMail:
    
        Next
        
        On Error GoTo 0
        
        newWB.Close
    End Sub

    Now the error is changed and it’s throw by the row in red color.
    This is the new error shown:

    Name:  Error.jpg
Views: 5419
Size:  12.1 KB


  29. May 17th, 2019, 07:24 AM


    #29

    Re: Run-time error ’48’ Error in loading DLL

    You should really add «Option Explicit» as the first line in your forms, modules and classes

    Where is «actualWB» defined ?
    What is «Defaultfolder» ?
    Where did you define «newWB» ?

    You are mixing Late Bound with Early Bound so it seems.
    Otherwise you should get much more errors.

    How/Where can I found the outlook constant

    https://docs.microsoft.com/en-us/off…defaultfolders


  30. May 17th, 2019, 07:55 AM


    #30

    Re: Run-time error ’48’ Error in loading DLL

    Yes exactly, the sheet1 should refer to that is in the workbook containing the code

    the workbook containing the code is always thisworkbook, or you can set you own variable

    Code:

    if Thisworkbook.sheets("Sheet1").Range("A4").Value = "1" Then

    Sorry I’ve used the yellow text but the row not is visible..

    i could read it by highlighting it, or optionally quoting it, but better to use some other colour

    Now the error is changed and it’s throw by the row in red color.

    this would indicate no folder was assigned to defaultfolder, your new code, it appears, is now trying to get the values from the newly opened workbook, but in any case, if the cell a4 did not contain a numeric from 1 to 5, defaultfolder would be an empty variant, if defaultfolder was dimensioned as object, it would in this case be nothing and no error would occur, but it would not help your code, just have another error further down
    not that you really need defaultfolder and myfolder

    personally i would prefer a select case to all those elseifs

    Code:

    select case thisworkbook.sheets("sheet1").range("a4")
      case 1:  ifolder = olFolderInbox ' =6
      case 2:  ifolder = olFolderSentMail ' =5
      case 3: ifolder = olFolderDeletedItems  ' =3
      case 4: ifolder = olFolderJunk  ' don't know this one
      case 5: ifolder = olFolderOutbox  '  =4
      case else: msgbox "not 1 to 5 in cell A4" :exit sub  ' invalid
    end select 
    Set Myfolder = MioMapi.GetDefaultFolder(ifolder)

    if the outlook constants do not contain any value, either declare them or use the literal values

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  31. May 20th, 2019, 01:32 AM


    #31

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    Code:

    Option Explicit
    
    Sub bottone()
        Dim XL As Object
        Dim WB As Object
        Dim Myfolder As Object
        Dim MioOutlook As Object
        Dim MioMapi As Object
        
        Dim olFolderInbox As Integer ' =6
        Dim olFolderSentMail As Integer ' =5
        Dim olFolderDeletedItems As Integer ' =3
        Dim olFolderJunk As Integer ' don't know this one
        Dim olFolderOutbox As Integer '  =4
        
        Dim actualWB As Object
        Dim newWB As Object
        Dim ifolder As Integer
        
        Set MioOutlook = CreateObject("Outlook.Application")
        Set MioMapi = MioOutlook.GetNamespace("MAPI")
        
        Set XL = CreateObject("Excel.Application")
        Set actualWB = XL.Workbooks.Open(Sheets("Sheet1").Range("A10").Value)
        
        
        Select Case ThisWorkbook.Sheets("sheet1").Range("A4")
          Case 1:  ifolder = olFolderInbox ' =6
          Case 2:  ifolder = olFolderSentMail ' =5
          Case 3: ifolder = olFolderDeletedItems  ' =3
          Case 4: ifolder = olFolderJunk  ' don't know this one
          Case 5: ifolder = olFolderOutbox  '  =4
          Case Else: MsgBox "not 1 to 5 in cell A4": Exit Sub  ' invalid
        End Select
        Set Myfolder = MioMapi.GetDefaultFolder(ifolder)  
        
        'Cerca prima cella libera
        Dim x As Integer
        Dim MaxDate As Integer
        Dim lung As Integer
        Dim Pos As Integer
        
        
        x = 0
        Do
            x = x + 1
        Loop Until newWB.Sheets("Sheet1").Cells(x, 1) = ""
        
        'Imposta data/ora massima
        If newWB.Sheets("Sheet1").Cells(2, 1) > "" Then
            MaxDate = CStr(newWB.Sheets("Sheet1").Cells(2, 1))
            lung = Len(MaxDate)
            Pos = InStr(MaxDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & Right(MaxDate, Pos)
            Else
                MaxDate = Mid(MaxDate, 7, 4) & "/" & Mid(MaxDate, 4, 2) & "/" & Mid(MaxDate, 1, 2) & " 0" & Right(MaxDate, Pos - 1)
            End If
        Else
            MaxDate = ""
        End If
           
        Dim obj As Object
        Dim SrcDate As Integer
        On Error GoTo SaltaMail
        
        For Each obj In Myfolder.Items
            
            SrcDate = CStr(obj.ReceivedTime)
            
            lung = Len(SrcDate)
            Pos = InStr(SrcDate, " ")
            Pos = lung - Pos + 1
            If lung = 19 Then
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & Right(SrcDate, Pos)
            Else
                SrcDate = Mid(SrcDate, 7, 4) & "/" & Mid(SrcDate, 4, 2) & "/" & Mid(SrcDate, 1, 2) & " 0" & Right(SrcDate, Pos - 1)
            End If
            
            If SrcDate > MaxDate Then
                If actualWB.Sheets("Sheet1").Range("A8").Value = "" Or actualWB.Sheets("Sheet1").Range("A8").Value = obj.SenderEmailAddress Then
                    newWB.Sheets("Sheet1").Cells(x, 1) = obj.ReceivedTime
                    newWB.Sheets("Sheet1").Cells(x, 2) = obj.Subject
                    newWB.Sheets("Sheet1").Cells(x, 3) = obj.Body
                    newWB.Sheets("Sheet1").Cells(x, 4) = obj.To
                    newWB.Sheets("Sheet1").Cells(x, 5) = obj.CC
                    newWB.Sheets("Sheet1").Cells(x, 6) = obj.BCC
                    newWB.Sheets("Sheet1").Cells(x, 7) = obj.ReceivedByName
                    newWB.Sheets("Sheet1").Cells(x, 8) = obj.SenderName
                    newWB.Sheets("Sheet1").Cells(x, 9) = obj.SenderEmailAddress
                    If obj.Attachments.Count > 0 Then
                        Dim i As Integer
                        For i = 1 To obj.Attachments.Count
                            obj.Attachments(i).SaveAsFile (actualWB.Sheets("Sheet1").Range("A6").Value & "" & obj.Attachments(i).Filename)
                        Next
                    End If
                    x = x + 1
                End If
            End If
            
    SaltaMail:
    
        Next
        
        On Error GoTo 0
        
        newWB.Close
    
    End Sub

    I modified the code with your tips, but I obtain always the same error «Run-time error ‘5’: Invalid procedure call or argument»


  32. May 20th, 2019, 05:23 AM


    #32

    Re: Run-time error ’48’ Error in loading DLL

    I tried a stripped version of your code
    And got the same error 5, because iFolder = 0
    When I changed iFolder to 6 the code does not raise an error

    Code:

    Sub bottone()
        Dim XL As Object
        Dim WB As Object
        Dim Myfolder As Object
        Dim MioOutlook As Object
        Dim MioMapi As Object
        
        Dim olFolderInbox As Integer ' =6
        Dim olFolderSentMail As Integer ' =5
        Dim olFolderDeletedItems As Integer ' =3
        Dim olFolderJunk As Integer ' don't know this one
        Dim olFolderOutbox As Integer '  =4
        
        Dim actualWB As Object
        Dim newWB As Object
        Dim iFolder As Integer
        
        Set MioOutlook = CreateObject("Outlook.Application")
        Set MioMapi = MioOutlook.GetNamespace("MAPI")
        
    '    Set XL = CreateObject("Excel.Application")
    '    Set actualWB = XL.Workbooks.Open(Sheets("Sheet1").Range("A10").Value)
        
    '
    '    Select Case ThisWorkbook.Sheets("sheet1").Range("A4")
    '      Case 1:  iFolder = 6 'olFolderInbox
    '      Case 2:  iFolder = 5 ' olFolderSentMail ' =5
    '      Case 3: iFolder = 3 ' olFolderDeletedItems  ' =3
    '      'Case 4: ifolder = olFolderJunk  ' don't know this one
    '      Case 5: iFolder = 4 'olFolderOutbox  '  =4
    '      Case Else: MsgBox "not 1 to 5 in cell A4": Exit Sub  ' invalid
    '    End Select
         
        ' Hard coded to 6, no error
        iFolder = 6 'olFolderInbox ' =6
        Set Myfolder = MioMapi.GetDefaultFolder(iFolder)
        
    End Sub


  33. May 20th, 2019, 07:07 AM


    #33

    robycuccu is offline

    Thread Starter


    Junior Member


    Re: Run-time error ’48’ Error in loading DLL

    With hard coded to 6, I got this error: Run-time error ’91’: Object variable or With block variable not sent, on the follow line:Loop Until newWB.Sheets(«Sheet1»).Cells(x, 1) = «»


  34. May 20th, 2019, 07:28 AM


    #34

    Re: Run-time error ’48’ Error in loading DLL

    Because it’s not assigned to anything anywhere.

    And what is: thisworkbook ??

    It should be something like (untested!):

    Code:

    Set newWB = XL.WorkBooks.Add


  35. May 21st, 2019, 06:19 AM


    #35

    Re: Run-time error ’48’ Error in loading DLL

    And what is: thisworkbook ??

    thisworkbook is a built in excel object representing the workbook containing the code

    ? thisworkbook.fullname

    I modified the code with your tips, but I obtain always the same error

    did you test if the outlook constants were valid constants or empty variables, as i suggested
    you have now dimensioned them as variables, but not assigned any value to the variable
    if the constants have value you need to do nothing as they should just work correctly
    if the constants have no value then you should either assign them as constants (not variables) or use the literal values

    to test

    Code:

    debug.print olFolderInbox

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  36. May 21st, 2019, 07:33 AM


    #36

    Re: Run-time error ’48’ Error in loading DLL

    I don’t know which VBA robycuccu is using.
    Excel, Word, PowerPoint or Access??

    thisworkbook is a built in excel object representing the workbook containing the code

    ? thisworkbook.fullname

    ThisWorkWork only exists in Excel VBA.
    And when using Excel, why using the below code???

    Code:

    Dim XL as Object
    
    Set XL = CreateObject("Excel.Application")


  37. May 21st, 2019, 07:44 AM


    #37

    Re: Run-time error ’48’ Error in loading DLL

    from post #2

    are you doing this code in excel?
    do you really need a new instance of excel? you can just open the additionally required workbook in the same instance,

    from post #3

    Yes, exact I’m doing this code in excel…a new instance of excel is a request of my boss ..I’m agree with you that is not necessary.

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  38. May 21st, 2019, 08:01 AM


    #38

    Re: Run-time error ’48’ Error in loading DLL

    Oke, but what a mess it becomes with all implicit references mixed with explicit references.


  39. May 21st, 2019, 04:06 PM


    #39

    Re: Run-time error ’48’ Error in loading DLL

    what a mess it becomes with all implicit references mixed with explicit references.

    amen to that

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  • Home
  • VBForums
  • Visual Basic
  • Office Development
  • Run-time error ’48’ Error in loading DLL


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
  • BB code is On
  • Smilies are On
  • [IMG] code is On
  • [VIDEO] code is On
  • HTML code is Off

Forum Rules


Click Here to Expand Forum to Full Width

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Runtime error 216 at 00404262
  • Runtime error 216 at 00403f16
  • Runtime error 216 at 00403e56
  • Runtime error 216 at 004
  • Runtime error 216 at 00002de0

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии