Меню

Ошибка file not found vba

Permalink

Cannot retrieve contributors at this time

title keywords f1_keywords ms.prod ms.assetid ms.date ms.localizationpriority

File not found (Error 53)

vblr6.chm50012

vblr6.chm50012

office

7161c105-4859-2b1b-bddf-b390deeb710c

06/08/2017

high

The file was not found where specified. This error has the following causes and solutions:

  • A statement, for example, Kill, Name, or Open, refers to a file that doesn’t exist. Check the spelling of the file name and the path specification.

  • An attempt has been made to call a procedure in a dynamic-link library (DLL), but the library or resource file name specified in the Lib clause of the Declare statement can’t be found.

    Check the spelling of the file name and the path specification.

  • In the development environment, this error occurs if you attempt to open a project or load a text file that doesn’t exist.

    Check the spelling of the project name or file name and the path specification.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

[!includeSupport and feedback]

Файл не найден в указанном расположении. Эта ошибка имеет следующие причины и способы решения:

Один из операторов, например Kill, Name или Open, ссылается на несуществующий файл. Проверьте, правильно ли указаны имя файла и путь.

Совершена попытка вызова процедуры из динамической библиотеки (DLL), однако имя файла библиотеки или ресурса в предложении Lib оператора Declare не найдено.

Проверьте, правильно ли указаны имя файла и путь.

В среде разработки эта ошибка возникает при попытке открыть несуществующий проект или загрузить несуществующий текстовый файл.

Проверьте, правильно ли указаны имя файла и путь.

Для получения дополнительной информации выберите необходимый элемент и нажмите клавишу F1 (для Windows) или HELP (для Macintosh).

Поддержка и обратная связь

Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.

Excel VBA — Run-time error ’53’: File not found. But file was found

I have an Excel sheet that pulls data from a folder full of .txt documents. Last week Friday, it worked. Nothing changed. This week Monday, I get a Run-time error ’53’: File not found.

What’s interesting, is that when I click «Debug» it highlights a line in my code, and when I mouse over the ‘sFile’ variable, it tells me the name of the file that it apparently can’t find. but it could only know the name of it if it found it. And yes, I’ve verified, that file does exist.

The Excel sheet is in H:My DocumentsLoma CW3 Reports

The data .txt files are in H:My DocumentsLoma CW3 ReportsProduct Statistics

The first 3 files that it should be pulling are:

Like mentioned above, when I’m debugging the code and mouse-over «sFile» in the line «Open sFile For Input As #1», it tells me:

Which it could only know if it was successfully scanning the folder since I don’t hardcode any of those file names in.

I have tried removing that file, renaming the file to a word like ‘apple’, checked to see if it became read-only (nope). I’m thrown for a loop here, because it worked as is last week, and nothing changed from when I opened it up this week and tried it.

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

В этой статье представлена ошибка с номером Ошибка 53, известная как Ошибка Microsoft Word 53, описанная как Ошибка выполнения.

Информация об ошибке

Имя ошибки: Ошибка Microsoft Word 53
Номер ошибки: Ошибка 53
Описание: Ошибка выполнения.
Программное обеспечение: Microsoft Word
Разработчик: Microsoft

Этот инструмент исправления может устранить такие распространенные компьютерные ошибки, как BSODs, зависание системы и сбои. Он может заменить отсутствующие файлы операционной системы и библиотеки DLL, удалить вредоносное ПО и устранить вызванные им повреждения, а также оптимизировать ваш компьютер для максимальной производительности.

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

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

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

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

  • Время выполнения — время выполнения — это время, в течение которого программа работает, выполняя
  • Ошибка выполнения — ошибка выполнения обнаруживается после или во время выполнения программы.
  • Microsoft word — по вопросам программирования, связанным с редактором Microsoft Word
Симптомы Ошибка 53 — Ошибка Microsoft Word 53

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

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

Fix Ошибка Microsoft Word 53 (Error Ошибка 53)

(Только для примера)

Причины Ошибка Microsoft Word 53 — Ошибка 53

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

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

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

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

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

I’m working on a big Access 2003 project with Microsoft Access 2007­. Recently, some users have started to experience problems with the buttons in my forms. For example, without any specific reason, clicking on a button or trying to execute any code will return the error:

File not found

There is no way to go into debug mode. When this happens the only thing to do is to restart the database. I tried adding the Stop command at the beginning of the executed block to try debugging it, but no code is executed at all. It’s like a compilation error but it’s only happening 5-10% of the time, which is really weird.

After some research, I found other people are having the same problem, for example this and this link. There are other examples too, with no real solutions yet.

My database can be okay for a week and then the problem starts to happen again. Half the time and users can’t do much; they need to restart the database once or twice to get it back working, and after a few minutes the error might happen again.

Because this is Access 2007 and there are a lot of people experiencing this bug, I can’t believe it isn’t more documented.

What’s the problem? Is the database somehow partially corrupted? What should I do? This is really annoying.

I say Reinstate Monica's user avatar

asked Apr 10, 2013 at 17:41

dan's user avatar

6

If I was in this situation one of the first things I would try would be to do a complete decompile+compact+recompile operation on the front-end database file, and then distribute that updated front-end out to the users to see if that improves things.

Detailed instructions on the decompile+compact+recompile steps are available here. Note: Be sure to read David W. Fenton’s additional recommendations in his answer.

Community's user avatar

answered Apr 11, 2013 at 16:53

Gord Thompson's user avatar

Gord ThompsonGord Thompson

113k30 gold badges203 silver badges404 bronze badges

3

I had just experienced this for the first time. I had been making extensive coding changes in a form, and was required to reboot my PC without finishing debugging the code. When I opened the app, I immediately got the «file not found» message (it auto-starts a different form).

On a whim, I went to the form in question and commented out that entire module’s code and the problem went away. After I went back in and uncommented that code, everything still worked as normal. I was able to continue debugging that code and lived for the rest of the day happily.

answered Sep 25, 2015 at 17:21

Dennis Flory's user avatar

though this thread is over a year old I would like to share another very helpful observation.

This error «File not found:» may be caused by differing save behavior of Office versions and may not have anything to do with your code! In case of this error, try to open and save your troubled file in another Office version and it may work fine back in your main Office version.

Details:
Though programming VBA for years now, I had never had an unsolicited «File not found:» error. Weird also that the error message does not give a file name for the file not found. (Reminded me of another nasty error VBA sometimes shows on startup for no obious reason and erratically.) Luckily this error started after my first edits in PowerPoint 2010 after having tested the file in PowerPoint 2016. The error occurred when opening the .pptm but I had no startup procedure involving a file. So I’ve got the idea of some file in the .pptm zip archive not being found. Started to do a quick search on the internet and found only «shooting in the dark» suggestions. As I could start PowerPoint 2013 more easily (virtual machine) than PowerPoint 2016 (different Windows 10 boot partition), I tried to open the troubled file in PowerPoint 2013 and had no problems. I compiled the VBA project to check for error. Nothing. And save the file. After this re-saving in PowerPoint 2013, the file seems to work fine again in PowerPoint 2010 und did not show any problems after the first few edits, saves and re-opening. This being said, I wonder if PowerPoint 2016 saving is peculiar and if I can replicate/if I will run into the error again if saving the file again in PowerPoint 2016 and returning to PowerPoint 2010. (I’ll make a note of this thread to add new insights once I worked with this file again in PowerPoint 2016.)

Hope this observation may spare many unnecessary un-/re-installations of Office and other desperate attempts.

Cheers!

answered May 29, 2016 at 17:51

www.MSOffice-deluxe.com's user avatar

3

A similar thing has just happened to me a couple of times with one of my .mdb front ends running in Access 2013, after the August 2019 update to Windows 10.

My DBs too have been through several versions of Access. On opening the database it says ‘File Not Found’ and throws up a public module (not one on which I have been working extensively recently), without opening the Autoexec (Switchboard) form. ‘Debug, Compile’ is possible and doesn’t suggest any problem.

For me too, typing one space (or blank line or other character) anywhere in the code, and then deleting it, and saving, closing and re-opening seemed to provide a workaround, and all has been well for the last few days (I am the only user at present).

There is no one obvious module involved, although I will probably suspect the form module I have been working on most recently if the problem persists in a troublesome way.

Now, a few days later I have de-compiled, compacted and re-compiled the database, halving its size, so maybe that will have done the trick. I hope so.

answered Aug 27, 2019 at 5:27

Buyani's user avatar

I just had this problem. In my case, I think the issue is having a blank VBA module. I was moving procedures from one module to another and ended-up with a blank module. I couldn’t delete the module manually and every time I tried to create a procedure to delete blank modules, I received the «File not found» error and the procedure I had just created was blanked out. I ended-up reverting to a backup.

answered Sep 22, 2013 at 20:50

Hugh Seagraves's user avatar

Hugh SeagravesHugh Seagraves

5841 gold badge8 silver badges14 bronze badges

The issue is just your references. One of the files for your references has been moved/deleted/updated. Remove and re-add your references to figure out which one.

answered Mar 24, 2014 at 14:35

Steve M.'s user avatar

I had a problem similar to this. A blank «File Not Found» error.

I turned off AutoCorrect and after clicking through several prompts/warnings which had me concerned, I then reopened the database and the error went away.

When reopening the database the problem was resolved.

I suspect this will fix many «File not found» errors which are probably related to the temporary link table losing a reference for whatever reason.

answered Jul 23, 2014 at 22:41

enderland's user avatar

enderlandenderland

13.6k16 gold badges99 silver badges151 bronze badges

I had this same issue MS Excel.

On the user pressing a button a useless File Not Found error appeared.

I ran through all suggested above and no change or help.

COMPLETELY ACCIDENTALLY I removed a module that i use for updating the Application status. This also has some array storage within. However, on removing this module (and commenting out references to it within my code) it appears that the issue is now fixed across users.

One Issue, is I have the same Module name within several different deployment’s of Excel Add-ins. I suspect that on first run Excel isn’t able to automatically assume the difference between them.

I had noticed a WORK AROUND for the error in which you create a break point on the first line of code for the button in question and then resume on break — I assume that this helped Excel evaluate and namespace the modules as to not cause conflicts.

answered Nov 26, 2014 at 11:43

SwiftJr's user avatar

I had that problem and solved it this way: I eliminated the form where the vba code was and imported the same form from a backup file made before.

answered Jan 12, 2015 at 15:21

Rafael Eduardo Barreto Mendez's user avatar

I found yet another solution (at least in my case): In trying to find the error, I tested the application I created on a co-workers computer. This somehow reset whatever went haywire in the file. Afterwards I was able to open up the file on my computer again and everything worked as it should!

EDIT: I have realized that the error, im my case, seems to have been connected in some way to my using SendKeys (see my attempt to automate a report here on SO).

Community's user avatar

answered Jul 30, 2015 at 13:19

rohrl77's user avatar

rohrl77rohrl77

3,21511 gold badges46 silver badges73 bronze badges

4

Had the same problem. I stumbled on the fix by accident. For whatever reason, simply adding an on-click Event Procedure made everything better.

  • Open the form in design mode
  • Select an object on the form
  • Press F4 to display the object’s properties
  • object properties
  • Event > On Click > dropdown > click [Event Procedure]
  • Then click the three dots, which will create a new event, and launch the Visual Basic editor. This will also add default code into the Visual Basic editor
  • Make no other changes
  • Save and close changes to the form
  • Restart the database

For what its worth, as I was wrestling with this issue, the error resolved itself in other ways, but none of them were repeatable.

Community's user avatar

answered Apr 12, 2016 at 17:56

LeftyMaus's user avatar

LeftyMausLeftyMaus

3603 silver badges13 bronze badges

I had this problem as well, and compact/repair did not fix it. In my case I had an old VBA module that was no longer used, and which referenced an object class that no longer existed. Removing the non-compiling code fixed the issue for me.

answered Nov 7, 2017 at 20:29

SmrtGrunt's user avatar

SmrtGruntSmrtGrunt

84913 silver badges24 bronze badges

I have had this problem for many years now in access 2010. Always in the Autoexec form that opens on msaccess startup. I tried creating a very simple form that calls the original more complex form. To my surprise the more problem moved the the new simple form. By trial and error, I found that just editing the new simple Autoexec form the problem would go away, but turn up randomly months later ALWAYS after I had made programming changes elsewhere. Sometimes instead of the file not found error, I get just get a crash out of access — but the solution is the same procedure — make a small edit to the autoexec file (just add new blank line will do). My project has come through many versions of access (2000 -> 2010). If there was some way to automate the editing of my autoexec form, then restarting access — this would serve as a workaround. I have not found any way as yet.

answered May 5, 2018 at 21:01

Christopher Fisher's user avatar

I have had this problem for years in my access database. I tried all the above solutions an they all fixed the problem, only to have the problem reappear sometime later — always after VBA code change. I discovered that decompiling and then recompiling ALWAYS FIXES this problem, and is the quickest and easiest way to do so. So I have concluded that there is a bug in way Office only partly compiles after program changes like macros and VBA code changes. After a number of changes the system gets ‘unhinged’ and throws up the ‘file not found’ error. Reading thru the fixes users have found in this blog supports my theory. Nearly all these fixes would probably cause some sort and recompile the unhinged code.

MY SOLUTION

In summary I have found the following..

  1. Doing a Decompile (without a recompile) will get rid of the error — but if the code is run on a different machine the error appears again.

  2. Doing a decompile, then a recompile followed by a Compact and Repair results makes my app run on other machines with out any problems.

Dharman's user avatar

Dharman

29.2k21 gold badges79 silver badges131 bronze badges

answered Dec 6, 2020 at 18:41

Chris Fisher's user avatar

I had a class module — Class1 — that was not used. I deleted it and did a compact and repair.
Something happened that caused the name of the class module to stay in the Navigation Pane but the module as such was removed:
When opening the VBA editor I got the «File not found».
Impossible to delete the name from the Navigation Pane!!
When decompiling the project I got «An error occurred while loading ‘Class1’. Do you want to continue loading the project?»
I did — now the Class1 was still in Navigation Pane when opening project again but now I could delete from the Navigation Pane.
After that the message about file not found no longer appeared.
FYI

answered Mar 14, 2021 at 2:06

borgesh's user avatar

0 / 0 / 0

Регистрация: 22.02.2018

Сообщений: 37

1

Excel

05.12.2019, 15:00. Показов 3631. Ответов 13


Добрый день, подскажите пожалуйста в чем может быть проблема: у меня на пк работает макрос в процессе которого открывается файл файл.txt, при этом на другом пк точно такой же макрос, при открытии txt, выдаёт ошибку “file not found”. Пытался менять название на file.txt — ошибка сохраняется. Условия запуска файла идентичны, только разные пользователи.

Спасибо

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



23 / 18 / 4

Регистрация: 29.05.2016

Сообщений: 82

05.12.2019, 15:59

2

пути файла одинаковые?



0



0 / 0 / 0

Регистрация: 22.02.2018

Сообщений: 37

05.12.2019, 16:16

 [ТС]

3

nyqpblcTuk, просто на рабочем столе, пользователь разный.



0



1777 / 1107 / 338

Регистрация: 11.07.2014

Сообщений: 3,905

05.12.2019, 17:29

4

Vitalii_sh, а рабочие столы у каждого пользователя свой? И где находится файл, в некой папке или на столе?



0



0 / 0 / 0

Регистрация: 22.02.2018

Сообщений: 37

05.12.2019, 17:33

 [ТС]

5

Burk, пк разные и рабочие столы разные) нет просто на рабочем столе, пробовал убирать в папку — не помогает. Путь привязан к excel файлу



0



1777 / 1107 / 338

Регистрация: 11.07.2014

Сообщений: 3,905

05.12.2019, 18:02

6

Vitalii_sh, ну прямо мистика, хотя всё должно быть просто. Надо файл смотреть. Вызываемый тхт можно и не присылать, сам сделаю, а то гадания не дают результата. Файл нужен с нехорошего компа.

Добавлено через 3 минуты

Цитата
Сообщение от Vitalii_sh
Посмотреть сообщение

Путь привязан к excel файлу

наверно в этом и дело. Посмотреть бы привязку.



0



Vitalii_sh

0 / 0 / 0

Регистрация: 22.02.2018

Сообщений: 37

05.12.2019, 19:31

 [ТС]

7

Burk, пользуюсь этим кодом, ломается на Set tso = fso.OpenTextFile(strFilePath, ForReading)

Visual Basic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 Sub test()     '
    strFilePath = "MyTestFile.txt"
 P = Thisworkbook.path
    Call ImportFromTxt(P & "файл.txt", "*строка*")
End Sub
 
Sub ImportFromTxt(ByVal strFilePath As String, ByVal strLike As String)
  Const ForReading As Byte = 1
  
  Dim i As Long
  Dim fso As Object, tso As Object
  Dim strLine As String
  Dim x As Long: x = 1
 
  Set fso = CreateObject("Scripting.FileSystemObject")      '
  Set tso = fso.OpenTextFile(strFilePath, ForReading)
 
  i = 1
  Do While Not tso.AtEndOfStream        '
        strLine = tso.ReadLine
    If strLine Like strLike Then
        Cells(x, 1).Value = strLine
        x = x + 1
    End If
    i = i + 1
  Loop
 
  tso.Close
  Set tso = Nothing
 
  Set fso = Nothing
End Sub



0



6874 / 2806 / 533

Регистрация: 19.10.2012

Сообщений: 8,550

05.12.2019, 22:03

8

Ничего не ломается. Скорее всего действительно нет файла
: strFilePath : «C:UsersIgorDownloadsфайл.txt» : String
Или Вы ожидали использовать совершенно не нужное коду strFilePath = «MyTestFile.txt»



0



0 / 0 / 0

Регистрация: 22.02.2018

Сообщений: 37

06.12.2019, 09:11

 [ТС]

9

Hugo121, проблема в этой строке? strFilePath = «MyTestFile.txt»



0



Остап Бонд

Заблокирован

06.12.2019, 09:19

10

Цитата
Сообщение от Vitalii_sh
Посмотреть сообщение

strFilePath = «MyTestFile.txt»

никакого отношения к Sub ImportFromTxt не имеет, Hugo121 вам вчера об этом говорил.
Пройдите, нажимая на [F8], процедуру test и увидите — что вы передаете в ImportFromTxt



0



0 / 0 / 0

Регистрация: 22.02.2018

Сообщений: 37

06.12.2019, 11:16

 [ТС]

11

Остап Бонд, передаётся то, что нужно. Думал может в этой строке причина

Добавлено через 25 минут
Hugo121, проверил ещё раз на другом пк. убрал эту ненужную строку, результат тот же. Путь прописывается правильный. Я думал, может какие то настройки не включены, но вроде все одинаково.



0



1777 / 1107 / 338

Регистрация: 11.07.2014

Сообщений: 3,905

06.12.2019, 11:44

12

Vitalii_sh, ну не может так быть — всё правильно, а не видит. Hugo проверил, я тоже запустил ваш макрос, всё Ок
Вариант напр. в txt либо в файле, либо в макросе стоит х — русское и т.п.
Посылаю вам ваш файл с вашими кодами и текстовый проверочный файл, которые у меня прошли на ура. Поставьте их на плохую машину (в одну папку) и запустите. Если всё пройдет, ищите да обрящите.



0



1777 / 1107 / 338

Регистрация: 11.07.2014

Сообщений: 3,905

06.12.2019, 11:54

13

и пока ищете, поставьте в 14 строку MsgBox strFilePath



0



0 / 0 / 0

Регистрация: 22.02.2018

Сообщений: 37

06.12.2019, 12:35

 [ТС]

14

Burk, хорошо. Спасибо. Да я верю, что-то не так. Просто у меня работает у него нет, думал может есть то, что не заметил сам.



0



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

06.12.2019, 12:35

14

  • Remove From My Forums
  • Question

  • Hello.

    I don’t know if this is the right place to post this error but I really need help.

    When I run some games programmed with Visual Basic, I get the following error:

    Run-time error ’53’:

    File not found

    I am running Windows ME (I wonder if that can help). If anyone could help me, I would be really grateful. Thanks.

    Regards,

    PedroMCN

Answers

  • I doubt anyone can help you other than the author of these games.

    It’s almost certain that the error is accurate in that a file isn’t found but given that information alone there isn’t much we can do.

  • Agree with what Renee says but also you say they are programmed with VB.  

    Are you simply the end-user of the games, in which case this is probably the wrong place.   You also say Games — plural is this occuring for a number of different applications or just one ?

    Or do you have to source code for the games and am having problems debugging — in which case which version of visual basic are you using as Error handling like this was often replaced with Exception handling in VB.Net which provides a great deal more flexibility.

    Either way for us to help you you need to provide more information and its probably much simpler to go back to the original author of the application.

  • If the error actually specifies the file, you can try looking for it on your instalation media.

    Otherwise, I’d try reinstalling the game, it sounds like something failed on setup.

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

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

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Ошибка file not found easyanticheat launcher settings json
  • Ошибка file error reading gta3 img