Содержание
- В разрешении отказано (ошибка 70)
- Поддержка и обратная связь
- Vba run time error 70 permission denied
- Answered by:
- Question
- Vba run time error 70 permission denied
- Answered by:
- Question
- Thread: Run-time error ’70’: Permission denied ->when i run code
- Run-time error ’70’: Permission denied ->when i run code
- Vba run time error 70 permission denied
- Answered by:
- Question
- Answers
В разрешении отказано (ошибка 70)
Сделана попытка записать на диск, защищенный от записи, или получить доступ к заблокированному файлу. Эта ошибка имеет следующие причины и решения:
сделана попытка открыть защищенный от записи файл для последовательного вывода или добавления. Откройте файл для ввода или измените атрибут защиты файла от записи;
сделана попытка открыть файл на диске, защищенный от записи для последовательного вывода или добавления. Удалите с диска устройство защиты от записи или откройте файл для ввода;
сделана попытка записать в файл, заблокированный другим процессом. Чтобы открыть файл, дождитесь, пока процесс завершит работу с ним;
вы попытались получить доступ к реестру, но ваши разрешения пользователя не включают этот тип доступа к реестру.
В 32-разрядных операционных системах Microsoft Windows пользователь должен иметь правильные разрешения для доступа к реестру системы. Измените свои разрешения или обратитесь к системному администратору, чтобы он изменил их.
Для получения дополнительной информации выберите необходимый элемент и нажмите клавишу F1 (для Windows) или HELP (для Macintosh).
Поддержка и обратная связь
Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.
Источник
Vba run time error 70 permission denied
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
The larger snippet of code below works perfectly on *most* Vista machines with Administrator rights? When it’s not Administator (and on some laptops with Administrator log in) I get «Runtime error 70, permission denied.» I believe this is because it’s trying to write a file to the C:/. I debugged, and the code gets caught up at:
cht1.Chart.Export strPath & «DailyBoard.jpeg»Export to Strpath
As soon as it tries to write the first file to the C:/ drive it generates the error.
I have researched runtime error 70 at nauseam and can’t find a work-a-round. I will not be able to change all the permissions settings on every computer this might try to be run on. Not all users will be able to log on as an Administrator. If there’s a way to bypass this problem, or to save directly to the users desktop, I’m ok with that? I just need to avoid this error on non-Administrator log ins. Any ideas?
This was tested on 5 Vista PC’s with Macro security settings «enabled» in Excel 2007.
2 logged on as Administrator, code worked perfectly
2 logged on as regular user without Admin rights, runtime error 70
1 logged on as Administrator (laptop), also runtime error 70
Code:
Sub Mail_Range_Outlook_Body()
‘ Working in Office 2000-2007
MsgBox «Please stop and make sure Outlook is open first, THEN click OK.»
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim sj
Dim em
Dim pic1 As Excel.Range
Dim pic2 As Excel.Range
Dim cht1 As Excel.ChartObject
Dim cht2 As Excel.ChartObject
Dim pic3 As Excel.Range
Dim cht3 As Excel.ChartObject
Const strPath As String = «C:»
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set sj = ActiveSheet.Range(«F10»)
Set em = ActiveSheet.Range(«F11»)
Set pic1 = Sheet7.Range(«A1:M41»)
pic1.CopyPicture xlScreen, xlPicture
Set cht1 = ActiveSheet.ChartObjects.Add(0, 0, pic1.Width, pic1.Height)
cht1.Chart.Paste
cht1.Chart.Export strPath & «DailyBoard.jpeg»
cht1.Delete
Set cht = Nothing
Set cht1 = Nothing
Set pic2 = Sheet24.Range(«A1:G42»)
pic2.CopyPicture xlScreen, xlPicture
Set cht2 = ActiveSheet.ChartObjects.Add(0, 0, pic2.Width, pic2.Height)
cht2.Chart.Paste
cht2.Chart.Export strPath & «WeeklyInfo.jpeg»
cht2.Delete
Set cht = Nothing
Set cht2 = Nothing
Set pic3 = Sheets(«Email_Template»).Range(«A6:B63»).SpecialCells(xlCellTypeVisible)
pic3.CopyPicture xlScreen, xlPicture
Set cht3 = ActiveSheet.ChartObjects.Add(0, 0, pic3.Width, pic3.Height)
cht3.Chart.Paste
cht3.Chart.Export strPath & «NightlyEmail.jpeg»
cht3.Delete
Set cht = Nothing
Set cht2 = Nothing
Set rng = Nothing
On Error Resume Next
Set rng = Sheets(«Email_Template»).Range(«A6:B63»).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox «The selection is not a range or the sheet is protected» & _
vbNewLine & «please correct and try again.», vbOKOnly
Exit Sub
End If
Set OutApp = CreateObject(«Outlook.Application»)
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = em
.CC = «»
.BCC = «»
.Subject = sj
.HTMLBody = RangetoHTML(rng)
.Attachments.Add «c:NightlyEmail.jpeg»
.Attachments.Add «c:DailyBoard.jpeg»
.Attachments.Add «c:WeeklyInfo.jpeg»
.Display ‘or use .Send
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
Set rng = Nothing
Источник
Vba run time error 70 permission denied
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
The larger snippet of code below works perfectly on *most* Vista machines with Administrator rights? When it’s not Administator (and on some laptops with Administrator log in) I get «Runtime error 70, permission denied.» I believe this is because it’s trying to write a file to the C:/. I debugged, and the code gets caught up at:
cht1.Chart.Export strPath & «DailyBoard.jpeg»Export to Strpath
As soon as it tries to write the first file to the C:/ drive it generates the error.
I have researched runtime error 70 at nauseam and can’t find a work-a-round. I will not be able to change all the permissions settings on every computer this might try to be run on. Not all users will be able to log on as an Administrator. If there’s a way to bypass this problem, or to save directly to the users desktop, I’m ok with that? I just need to avoid this error on non-Administrator log ins. Any ideas?
This was tested on 5 Vista PC’s with Macro security settings «enabled» in Excel 2007.
2 logged on as Administrator, code worked perfectly
2 logged on as regular user without Admin rights, runtime error 70
1 logged on as Administrator (laptop), also runtime error 70
Code:
Sub Mail_Range_Outlook_Body()
‘ Working in Office 2000-2007
MsgBox «Please stop and make sure Outlook is open first, THEN click OK.»
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim sj
Dim em
Dim pic1 As Excel.Range
Dim pic2 As Excel.Range
Dim cht1 As Excel.ChartObject
Dim cht2 As Excel.ChartObject
Dim pic3 As Excel.Range
Dim cht3 As Excel.ChartObject
Const strPath As String = «C:»
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set sj = ActiveSheet.Range(«F10»)
Set em = ActiveSheet.Range(«F11»)
Set pic1 = Sheet7.Range(«A1:M41»)
pic1.CopyPicture xlScreen, xlPicture
Set cht1 = ActiveSheet.ChartObjects.Add(0, 0, pic1.Width, pic1.Height)
cht1.Chart.Paste
cht1.Chart.Export strPath & «DailyBoard.jpeg»
cht1.Delete
Set cht = Nothing
Set cht1 = Nothing
Set pic2 = Sheet24.Range(«A1:G42»)
pic2.CopyPicture xlScreen, xlPicture
Set cht2 = ActiveSheet.ChartObjects.Add(0, 0, pic2.Width, pic2.Height)
cht2.Chart.Paste
cht2.Chart.Export strPath & «WeeklyInfo.jpeg»
cht2.Delete
Set cht = Nothing
Set cht2 = Nothing
Set pic3 = Sheets(«Email_Template»).Range(«A6:B63»).SpecialCells(xlCellTypeVisible)
pic3.CopyPicture xlScreen, xlPicture
Set cht3 = ActiveSheet.ChartObjects.Add(0, 0, pic3.Width, pic3.Height)
cht3.Chart.Paste
cht3.Chart.Export strPath & «NightlyEmail.jpeg»
cht3.Delete
Set cht = Nothing
Set cht2 = Nothing
Set rng = Nothing
On Error Resume Next
Set rng = Sheets(«Email_Template»).Range(«A6:B63»).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox «The selection is not a range or the sheet is protected» & _
vbNewLine & «please correct and try again.», vbOKOnly
Exit Sub
End If
Set OutApp = CreateObject(«Outlook.Application»)
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = em
.CC = «»
.BCC = «»
.Subject = sj
.HTMLBody = RangetoHTML(rng)
.Attachments.Add «c:NightlyEmail.jpeg»
.Attachments.Add «c:DailyBoard.jpeg»
.Attachments.Add «c:WeeklyInfo.jpeg»
.Display ‘or use .Send
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
Set rng = Nothing
Источник
Thread: Run-time error ’70’: Permission denied ->when i run code
Thread Tools
Display
Run-time error ’70’: Permission denied ->when i run code
I have been using this code for over a year and all of a sudden i can not run without getting the Run-time error ’70’: Permission denied.
I have tried just about every thing and all the webs info on this matter that i have found has not worked.
I have Windows 7 Ultimate. I noticed that my office 2007 completely and excel did an update back 10 days ago but i am sure i used it since then because i have had jobs to complete for the company i use this code on since then. The odd thing is that code very similar to this works for other websites on this same laptop. I have noticed some security pop up which i normally allow but i may have clicked not to once or twice, so i disabled avast security just to see, but nothing same issue. The next thing i thought maybe the owners of the Website itself changed something and now i can’t fill out there forms. So i opened the code with my other laptop that is Windows vista and it runs it fine with out any issues. I googled this issue and one post looked to have promise disabling User Account Control, but that did not work either and noticing also that my vista had it activate i should have known this was not going to work. I have three similar codes for the same website that i work with, but all three have the same issue even if i have been working with only one of them in the last few days.
On the code below if the cell «B24» were empty it would normally warn and say «Website is not opened yet», but it does not its steps threw this code and it acts as if the website url is in the «B24» cell and then tries to execute my code and it fails with the Run-time error we are now talking about. Note that it does this either with or without the «B24» cell having the URL in it.
I also thought internet explorer is causing it and is blocking the website, but i could not find it as a blocked website or popup.
So what could be causing this issue. Is it the code that i have not changed and always worked before, Excel program itself, security setting that i may have blocked and had nothing to do with avast security software, any suggestion welcome.
Last edited by SamT; 12-22-2014 at 11:59 AM . Reason: Formatted Code with # icon
Without a URL and the Owner and APN strings to test, it is hard to test.
Hopefully, you have tried Compile before a Run. If the Compile fails, I suspect it would be due to the MSIE browser object not being set in the References. You can check that as well in VBE’s Tools > References.
Tip: Now we use Code tags rather than VBA tags for posting code. Click the # icon to insert those or type them.
Источник
Vba run time error 70 permission denied
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
I am using MS Access DataBase for my Application.
On the User InterFace as soon as i click on the ComboBox i start getting the the Error Message : Runtime Error ’70’ Permission Denied.
On the RowSource Property of ComboBox my setting in an Select Query.
I need Help on this, i have also checked the DCOM Properties.
Thanks And Regards
Answers
Well, I came accross this thread:
-17. How can I fix the Run-time error ’70’: Permission Denied?
A: Your computer may not have the necessary registry information for the class «Access.Application». Please run regedit to search Access.Application class. If it’s missing you may need to repair your Access. If you are running our converters on a Vista system you need to run them as Administrator.
Hope this helps,
Daniel van den Berg | Washington, USA | «Anticipate the difficult by managing the easy»
Источник
- Remove From My Forums
Excel 2007 — Runtime Error 70 — Permission Denied
-
Question
-
Aloha Friends:
The larger snippet of code below works perfectly on *most* Vista machines with Administrator rights? When it’s not Administator (and on some laptops with Administrator log in) I get «Runtime error 70, permission denied.» I believe this is because it’s trying to write a file to the C:/. I debugged, and the code gets caught up at:
cht1.Chart.Export strPath & «DailyBoard.jpeg»Export to Strpath
As soon as it tries to write the first file to the C:/ drive it generates the error.
I have researched runtime error 70 at nauseam and can’t find a work-a-round. I will not be able to change all the permissions settings on every computer this might try to be run on. Not all users will be able to log on as an Administrator. If there’s a way to bypass this problem, or to save directly to the users desktop, I’m ok with that? I just need to avoid this error on non-Administrator log ins. Any ideas?
This was tested on 5 Vista PC’s with Macro security settings «enabled» in Excel 2007.
2 logged on as Administrator, code worked perfectly
2 logged on as regular user without Admin rights, runtime error 70
1 logged on as Administrator (laptop), also runtime error 70Code:
Sub Mail_Range_Outlook_Body()
‘ Working in Office 2000-2007
MsgBox «Please stop and make sure Outlook is open first, THEN click OK.»Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim sj
Dim em
Dim pic1 As Excel.Range
Dim pic2 As Excel.Range
Dim cht1 As Excel.ChartObject
Dim cht2 As Excel.ChartObject
Dim pic3 As Excel.Range
Dim cht3 As Excel.ChartObjectConst strPath As String = «C:»
With Application
.EnableEvents = False
.ScreenUpdating = False
End WithSet sj = ActiveSheet.Range(«F10»)
Set em = ActiveSheet.Range(«F11»)Set pic1 = Sheet7.Range(«A1:M41»)
pic1.CopyPicture xlScreen, xlPicture
Set cht1 = ActiveSheet.ChartObjects.Add(0, 0, pic1.Width, pic1.Height)
cht1.Chart.Paste
cht1.Chart.Export strPath & «DailyBoard.jpeg»
cht1.Delete
Set cht = Nothing
Set cht1 = NothingSet pic2 = Sheet24.Range(«A1:G42»)
pic2.CopyPicture xlScreen, xlPicture
Set cht2 = ActiveSheet.ChartObjects.Add(0, 0, pic2.Width, pic2.Height)
cht2.Chart.Paste
cht2.Chart.Export strPath & «WeeklyInfo.jpeg»
cht2.Delete
Set cht = Nothing
Set cht2 = NothingSet pic3 = Sheets(«Email_Template»).Range(«A6:B63»).SpecialCells(xlCellTypeVisible)
pic3.CopyPicture xlScreen, xlPicture
Set cht3 = ActiveSheet.ChartObjects.Add(0, 0, pic3.Width, pic3.Height)
cht3.Chart.Paste
cht3.Chart.Export strPath & «NightlyEmail.jpeg»
cht3.Delete
Set cht = Nothing
Set cht2 = NothingSet rng = Nothing
On Error Resume Next
Set rng = Sheets(«Email_Template»).Range(«A6:B63»).SpecialCells(xlCellTypeVisible)
On Error GoTo 0If rng Is Nothing Then
MsgBox «The selection is not a range or the sheet is protected» & _
vbNewLine & «please correct and try again.», vbOKOnly
Exit Sub
End IfSet OutApp = CreateObject(«Outlook.Application»)
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)On Error Resume Next
With OutMail
.To = em
.CC = «»
.BCC = «»
.Subject = sj
.HTMLBody = RangetoHTML(rng)
.Attachments.Add «c:NightlyEmail.jpeg»
.Attachments.Add «c:DailyBoard.jpeg»
.Attachments.Add «c:WeeklyInfo.jpeg»
.Display ‘or use .Send
End With
On Error GoTo 0With Application
.EnableEvents = True
.ScreenUpdating = True
End WithSet OutMail = Nothing
Set OutApp = Nothing
Set rng = Nothing-
Edited by
Monday, October 12, 2009 4:00 PM
Edit content -
Moved by
Martin Xie — MSFT
Tuesday, October 13, 2009 9:38 AM
Move it to VBA forum for better responses. (From:Visual Basic Language)
-
Edited by
Answers
-
The Vista UAC may be to blame. So if you can direct the output to a folder that is not locked, that would be the easiest solution. For example, you can direct output to MyDocuments.
-
Marked as answer by
Tim Li
Monday, October 19, 2009 3:03 AM
-
Marked as answer by
Jktu Пользователь Сообщений: 4 |
#1 14.12.2021 12:30:55 При открытии файла 1 сохраняю его как файл 2.
Средствами windows я переместить или удалить файл тоже не могу. Она говорит «Нет доступа или файл уже используется».
|
||||
Юрий М Модератор Сообщений: 60390 Контакты см. в профиле |
Jktu, зачем Вы пишете через строку? зачем растягивать сообщение? Не нужно жать на Enter по несколько раз. |
Дмитрий(The_Prist) Щербаков Пользователь Сообщений: 13997 Профессиональная разработка приложений для MS Office |
#3 14.12.2021 13:14:36
не запускать код из той книги, которую хотите в архив запихнуть. Ведь в момент попытки закинуть в архив файл с кодом — код-то выполняется, а значит файл по сути «открыт». Даже самый простой вопрос можно превратить в огромную проблему. Достаточно не уметь формулировать вопросы… |
||
Олег Пользователь Сообщений: 4 |
Не совсем так. Я сохранил файл с новым именем и фактически макрос крутиться в новом файле. Запускать код снаружи нет возможности. Изменено: Олег — 14.12.2021 13:30:42 |
Дмитрий(The_Prist) Щербаков Пользователь Сообщений: 13997 Профессиональная разработка приложений для MS Office |
#5 14.12.2021 14:05:48
это факт или Вы так думаете?
поясните так же — в какой момент Вы это пробуете делать? Это только с одним файлом или с любым файлом в этой папке? Изменено: Дмитрий(The_Prist) Щербаков — 14.12.2021 14:08:43 Даже самый простой вопрос можно превратить в огромную проблему. Достаточно не уметь формулировать вопросы… |
||||
Олег Пользователь Сообщений: 4 |
#6 14.12.2021 14:44:16 Я так думал. Я предполагаю, что я ошибался и ищу где именно. Судя по тому, что я вижу название нового файла в дереве проекта, я сделал вывод, что код крутится в новом файле. Диспетчер задач показывает 2 процесса excel после saveas. Я пытался вызывать новый макрос на перемещение файла. Результат не поменялся. Поэтому спрашиваю совет у опытных. SaveCopyAs, тоже вариант, но не идеальный. 1) в итоге мне нужно иметь файл с новым именем в открытом состоянии. возможно стоит поискать переименование. Более полный код:
Надеюсь будут ещё идеи. Изменено: Олег — 14.12.2021 15:04:59 |
||
vikttur Пользователь Сообщений: 47199 |
Олег, зачем так рвать сообщение? |
Юрий М Модератор Сообщений: 60390 Контакты см. в профиле |
#8 14.12.2021 15:29:59
|
||
Дмитрий(The_Prist) Щербаков Пользователь Сообщений: 13997 Профессиональная разработка приложений для MS Office |
#9 14.12.2021 16:31:07 Может попробовать правильно перемещать?
Даже самый простой вопрос можно превратить в огромную проблему. Достаточно не уметь формулировать вопросы… |
||
Евгений Смирнов Пользователь Сообщений: 539 |
#10 14.12.2021 16:54:40
Если исходный файл занят после оператора SaveAs мы в следующих строчках можем исходный файл( удалить, переместить, скопировать, переименовать)? Изменено: Евгений Смирнов — 14.12.2021 17:13:51 |
||
Евгений Смирнов, тут дело-то не простое…С одной стороны — файл не должен быть занят, если мы делаем Save As из меню. Там никаких отсылок на файл не остается. Но если делаем кодом — то какое-то время файл еще используется системой, т.к. его код был скомпилирован и он на текущий момент выполняется(да, там происходят процессы чуть иные, но будем считать так — файл все равно какое-то время после SaveAs используется). Сколько файл будет заблокирован зависит от того, где как и что происходит. Например, на локальном диске это будут скорее всего миллисекунды(опять же зависит от размера файла). После выполнения всех команд кода файл должен быть успешно перемещен в любом случае. А вот на сетевом(или что-то вроде виртуального рабочего стола) — это может занять и больше времени и вообще иначе отработать. Вроде код уже выполнил SaveAs и файл создался, и новый вроде как сейчас используется, а не исходный — но система все еще считает исходный файл занятым. И тут разные факторы могут повлиять на то, когда система его разблокирует и разблокирует ли вообще без презапуска Excel. Изменено: Дмитрий(The_Prist) Щербаков — 14.12.2021 17:25:55 Даже самый простой вопрос можно превратить в огромную проблему. Достаточно не уметь формулировать вопросы… |
|
Евгений Смирнов Пользователь Сообщений: 539 |
#12 14.12.2021 17:28:25 Дмитрий(The_Prist) Щербаков
Спасибо за пояснения. Но тогда ещё как вариант после SaveAs можно задержку воткнуть.
|
||
Дмитрий(The_Prist) Щербаков Пользователь Сообщений: 13997 Профессиональная разработка приложений для MS Office |
#13 14.12.2021 17:37:58
а смысл? Сначала надо диагностировать, а потом костыли вешать. А если файл и без задержек нормально переместиться? Ждать 10 секунд? Не самая лучшая идея. К тому же метод Wait опять же может удерживать файл в процессах. Так же, если проблема в ОС — файл может вообще не получится освободить ни через 10 секунд, ни через полчаса. Даже самый простой вопрос можно превратить в огромную проблему. Достаточно не уметь формулировать вопросы… |
||
Евгений Смирнов Пользователь Сообщений: 539 |
#14 14.12.2021 18:49:52 Дмитрий(The_Prist) Щербаков
А может в вашем коде и FSO не нужен Зачем лишние объекты
Изменено: Евгений Смирнов — 14.12.2021 18:50:25 |
||
sokol92 Пользователь Сообщений: 4429 |
#15 14.12.2021 19:50:12 Я в коде из #6 изменил присвоение ArchivePath на
и успешно выполнил макрос. P.S. Увидел в названии темы «Permissio» и опешил — неужели Excel был уже в Древнем Риме? Изменено: sokol92 — 14.12.2021 20:02:59 Владимир |
||
Дмитрий(The_Prist) Щербаков Пользователь Сообщений: 13997 Профессиональная разработка приложений для MS Office |
#16 15.12.2021 11:44:27
моего кода там и нет Даже самый простой вопрос можно превратить в огромную проблему. Достаточно не уметь формулировать вопросы… |
||
sokol92 Пользователь Сообщений: 4429 |
Дополнение к ответу Дмитрия. См. этo сообщение, п. 3.4. |
Олег Пользователь Сообщений: 4 |
Очень интересная картина. Как догадался Владимир, файлы лежат в сети. Заметил ещё вчера, что иногда, оно всё таки работает. Но очень иногда, он отрабатывал. Вчера думал показалось. Dir и Name пробовал, результат одинаковый. Заменители FO, типа Shell.Application использовать не умею. Подскажите пожалуйста, если можно. |
Дмитрий(The_Prist) Щербаков Спасибо за пояснения. Вчера сразу после вашего сообщения №3 я попробовал все действия с исходным файлом ( удалить, переместить, скопировать, переименовать) после SaveAs. На локальном компе все нормально. После сообщения №9 вчера, я так и понял в чем фишка вашего кода, почему он точно прокатит. А сегодня с утра заглянул снова в тему и наверно понял. 1. Вылазит Ошибка 70 « Отказано в доступе» значит недоступен либо исходный файл либо архивная папка 2. Вы добавили строку If Dir(NewFilePath, 16) = «». Здесь проверяется не только наличие файла в папке архива, но и доступность папки. Значит ошибка возникала из-за отказа в доступе к папке архива, а не к исходному файлу. Или я ошибаюсь? sokol92 Здравствуйте Владимир. Сообщение, п. 3.4. в вашей теме посмотрел. Скопировал на комп все пункты на всякий случай. Вряд ли конечно мне придется писать приложения на VBA в системах с различными версиями Windows. Начинающим такое не под силу. |
|
Олег Раз диск сетевой то мой код, не стоит пробовать, как подсказал sokol92 . Код Дмитрия Щербакова лучше. |
|
Дмитрий(The_Prist) Щербаков Пользователь Сообщений: 13997 Профессиональная разработка приложений для MS Office |
#21 15.12.2021 17:53:11
это больше по ошибке — в процессе проверки кода записал привычное обращение и забыл подменить на проверку ТС. Правильнее здесь применить то, что было у ТС:
и да и нет. Если недоступна папка — то и файл из неё недоступен. А приведенная мной конструкция проверяет именно наличие файла по указанному пути. Изменено: Дмитрий(The_Prist) Щербаков — 15.12.2021 17:54:35 Даже самый простой вопрос можно превратить в огромную проблему. Достаточно не уметь формулировать вопросы… |
||||||
Евгений Смирнов Пользователь Сообщений: 539 |
#22 15.12.2021 18:16:44
Тогда проблема вообще не в коде. Код ТС нормальный, исходя из последних сообщений Дмитрия Надо обратить внимание на сообщением №15
Изменено: Евгений Смирнов — 16.12.2021 05:00:47 |
||||
sokol92 Пользователь Сообщений: 4429 |
#23 15.12.2021 18:50:32
Если Excel «подвис» во время копирования, то, естественно, файлы будут заблокированы. Более того, поскольку диск сетевой, то любой пользователь, у которого копирование «зависло», будет мешать остальным. Уточните у своих системщиков, какого типа сетевой диск (Windows, Linux Samba, …). Изменено: sokol92 — 15.12.2021 18:51:13 Владимир |
||
vikttur Пользователь Сообщений: 47199 |
#24 16.12.2021 00:59:25 Олег, сообщение сами исправите или модераторам после Вас убирать? |
Номер ошибки: | Ошибка во время выполнения 70 | |
Название ошибки: | Permission denied | |
Описание ошибки: | An attempt was made to write to a write-protected disk or to access a locked file. | |
Разработчик: | Microsoft Corporation | |
Программное обеспечение: | Windows Operating System | |
Относится к: | Windows XP, Vista, 7, 8, 10, 11 |
Оценка «Permission denied»
«Permission denied» — это стандартная ошибка времени выполнения. Разработчики программного обеспечения пытаются обеспечить, чтобы программное обеспечение было свободным от этих сбоев, пока оно не будет публично выпущено. Ошибки, такие как ошибка 70, иногда удаляются из отчетов, оставляя проблему остается нерешенной в программном обеспечении.
После первоначального выпуска пользователи Windows Operating System могут столкнуться с сообщением «An attempt was made to write to a write-protected disk or to access a locked file.» во время запуска программы. Если возникает ошибка 70, разработчикам будет сообщено об этой проблеме через уведомления об ошибках, которые встроены в Windows Operating System. Microsoft Corporation может устранить обнаруженные проблемы, а затем загрузить измененный файл исходного кода, позволяя пользователям обновлять свою версию. Если есть уведомление об обновлении Windows Operating System, это может быть решением для устранения таких проблем, как ошибка 70 и обнаруженные дополнительные проблемы.
Как триггеры Runtime Error 70 и что это такое?
Сбой устройства или Windows Operating System обычно может проявляться с «Permission denied» в качестве проблемы во время выполнения. Вот три наиболее распространенные причины, по которым происходят ошибки во время выполнения ошибки 70:
Ошибка 70 Crash — Номер ошибки вызовет блокировка системы компьютера, препятствуя использованию программы. Если Windows Operating System не может обработать данный ввод, или он не может получить требуемый вывод, это обычно происходит.
Утечка памяти «Permission denied» — ошибка 70 утечка памяти приводит к тому, что Windows Operating System постоянно использует все больше и больше памяти, увяская систему. Возможные причины включают сбой Microsoft Corporation для девыделения памяти в программе или когда плохой код выполняет «бесконечный цикл».
Ошибка 70 Logic Error — логическая ошибка возникает, когда Windows Operating System производит неправильный вывод из правильного ввода. Это происходит, когда исходный код Microsoft Corporation вызывает уязвимость при обработке информации.
Microsoft Corporation проблемы с Permission denied чаще всего связаны с повреждением или отсутствием файла Windows Operating System. В большинстве случаев скачивание и замена файла Microsoft Corporation позволяет решить проблему. В некоторых случаях реестр Windows пытается загрузить файл Permission denied, который больше не существует; в таких ситуациях рекомендуется запустить сканирование реестра, чтобы исправить любые недопустимые ссылки на пути к файлам.
Типичные ошибки Permission denied
Типичные ошибки Permission denied, возникающие в Windows Operating System для Windows:
- «Ошибка приложения Permission denied.»
- «Ошибка программного обеспечения Win32: Permission denied»
- «Permission denied должен быть закрыт. «
- «Не удается найти Permission denied»
- «Permission denied не может быть найден. «
- «Ошибка запуска в приложении: Permission denied. «
- «Permission denied не выполняется. «
- «Permission denied выйти. «
- «Неверный путь к программе: Permission denied. «
Ошибки Permission denied EXE возникают во время установки Windows Operating System, при запуске приложений, связанных с Permission denied (Windows Operating System), во время запуска или завершения работы или во время установки ОС Windows. При появлении ошибки Permission denied запишите вхождения для устранения неполадок Windows Operating System и чтобы HelpMicrosoft Corporation найти причину.
Истоки проблем Permission denied
Большинство проблем Permission denied связаны с отсутствующим или поврежденным Permission denied, вирусной инфекцией или недействительными записями реестра Windows, связанными с Windows Operating System.
Более конкретно, данные ошибки Permission denied могут быть вызваны следующими причинами:
- Поврежденные ключи реестра Windows, связанные с Permission denied / Windows Operating System.
- Вредоносные программы заразили Permission denied, создавая повреждение.
- Permission denied злонамеренно или ошибочно удален другим программным обеспечением (кроме Windows Operating System).
- Другое приложение, конфликтующее с Permission denied или другими общими ссылками.
- Поврежденная загрузка или неполная установка программного обеспечения Windows Operating System.
Продукт Solvusoft
Загрузка
WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.
Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11
Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление
-
#2
Try manually going to that folder right click new txt file and see if you can enter few random characters and save file you might have only read only privs
-
#3
Thanks. I have full privileges so I don’t think that’s the problem.
-
#4
Can you verify what I suggested if you had full privs you wouldn’t be getting the message just in case the root shares have changed
-
#5
Your first sub opens the same file without closing it so that should be cleaned up (probably removed — looks like a piece of code that wasn’t finished and is abandoned). Possibly the file exists but is locked for editing. I would also suggest you verify that you have full privileges since the error message says you don’t.
-
#6
I am able to right click in the folder, create a new text file, enter characters, and save.
-
#7
@xenou
Do you have a recommendation to close the file? thx!
Last edited: Aug 13, 2019
-
#8
If I were to change the path to the desktop, is there a way to write the code so if I’m not running the code it would use the other person’s desktop location?
-
#9
To use a desktop folder based on the current user you can use the WScript shell host (among other techniques, I am sure). This is how I have done this over the years, e.g.:
Code:
Dim strDesktopFolderPath As String
strDesktopFolderPath = CreateObject("Wscript.Shell").SpecialFolders("Desktop")
Debug.Print strDesktopFolderPath
I don’t have a recommendation for closing file handles that have not been properly close. In general this stuff will clear up on its own as the operating system realizes the file handles are no longer in use. If there were some clear problem that you can’t otherwise resolve a reboot will do the trick.
-
#10
Thanks everyone! I added a line to close the txt file in the first sub. So far so good!
Code:
Open sFilePath For Output As [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=fileNumber]#fileNumber[/URL]
Close [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=fileNumber]#fileNumber[/URL]