Еще один вероятный источник
Такая ситуация возникла после июльских-2017 обновлений безопасности Windows. Все файлы надстроек скачанные из интернета или полученные по email теперь молча блокируются при загрузке в Excel. Чтобы это исправить:
Закройте все окна Excel
В проводнике (окне Мой компьютер) щелкните правой по файлу надстройки plex.xlam и выберите Свойства (Properties)
На вкладке Общие (General) внизу нажмите кнопку Разблокировать (Unblock).
Другой способ — добавить папку с надстройкой в список надежных расположений. Для этого выберите Файл – Параметры (File – Options), затем слева Центр управления безопасностью (Trust Center) – кнопка Параметры центра управления безопасностью (Trust Center Settings). В открывшемся окне слева сверху выбрать Надежные расположения (Trusted Locations) и, нажав внизу кнопку Добавить новое расположение (Add new location), указать папку надстройки.
Еще один вариант: запаковать все файлы надстройки в архив на вашем ПК, удалить исходные файлы и распаковать затем из архива обратно. Такое несложное «шаманство» позволяет обмануть Windows и заставить ее относиться к файлам скаченным из интернета более лояльно.
https://www.planetaexcel.ru/plex/plex-faq.php
i have an issues with an macro that i’m writing. I have my xlsm file that i’m writing my macro in, it’s creating a template that gets data from multiple spreadsheets that other people send me. However one file that i use for information is an xlsm file and is giving me problems. I believe i have isolated the problem but am unsure as to how to fix it.
the first sheet is named «Piranha» (no idea why), and the second sheet is named «Piranha — Dist & Growth split»
however when i write stardard code like
Sheets(«Piranha»).select
it has a runtime error 40036 (Application- defined or object defined error)
it also doesn’t like
ActiveSheet.select / .name
but only for those two sheets, there is another sheet named «Exceptions» and i can use that object no problem. Has anyone ever heard of this problem or better have any ideas on how to solve it? Also because it’s not my file if there is a way to do it without actually altering the file would be amazing. Thank you!
asked Jul 11, 2014 at 5:06
1
I had similar problem error 40036 and debugging pointed to a file path variable. When deleting or adding line of code the error moved…
I tried solution from Expert Exchange:
from VBA window do Debug>Compile VBAProject
fix any error raised
I fixed the error and it all works fine now
answered May 16, 2017 at 7:06
YaniYani
513 bronze badges
2
Thanks guys for your help, however i fiiiinally figured out that when trying to manipulate the file to get the data the macro of the file would interfere with my process, so i just make a copy of the file and delete all vb components and my code works fine
answered Jul 14, 2014 at 0:09
user3827978user3827978
411 gold badge1 silver badge3 bronze badges
In the file which is a problem, try compiling the VBA project (via Debug > Compile VBA Project in the VBA editor) and see if there is an error in any code in the relevant sheet modules
answered Jul 11, 2014 at 5:51
barrowcbarrowc
10.4k1 gold badge40 silver badges53 bronze badges
Sub test()
Sheets("Sheet1 & 2").Select
ActiveSheet.Select
End Sub
Sub test2()
Sheets("Sheet1").Select
ActiveSheet.Select
End Sub
Tested your issue with the above code and I was unable to replicate your fault. Perhaps there is a space at the beginning or end of one of the sheets? As for ActiveSheet not working, it works OK in my test. I think you need to check your code, or at least update your Question with your code so we can check it
answered Jul 11, 2014 at 6:59
LBPLCLBPLC
1,5503 gold badges27 silver badges50 bronze badges
All these answers talk about compiling and clearing errors. If you’re like me, you do that all the time. The answer didn’t seem clear to me so here it goes:
Not only does your macro workbook need to be free of errors, so do ALL other workbooks you open. So if you’re digging through a ton of data and you hit these bizarre object errors then it’s possible there is a workbook with compile errors in your dataset. No amount of debugging your main workbook will fix the problem.
You have to be able to successfully compile every workbook you open programmatically. The OP said something about stripping «the vb components» out of his data. Any method like this you can do that avoids macros in your target data workbooks will work-around this issue. You can save each file as macro-free XLSX and then pull data from that. Or you could use ADO to access the data in a query.
answered Jul 26, 2021 at 19:49
HackSlashHackSlash
4,7272 gold badges16 silver badges42 bronze badges
I have the same problem and solved it by first finding which sheet was being accessed at the time of the error.
I copied all the data from that sheet (including formulas, formatting) and pasted into a new sheet along wit the sheet’s VBA code. I deleted the old sheet and renamed the new set back to the old sheet.
On other words, I recreated everything back to what it was.
The error disappeared.
answered Nov 13, 2022 at 18:46
- Remove From My Forums
-
Question
-
I have a worksheet that has suddenly become inaccessible through VB code:
This line throws the error:
Sheets(«Activity Sheet»).Select
I can select the sheet manually.
If I record a macro, selecting the sheet as the only step in the macro, and then run the macro…same error
If I attempt to enumerate the worksheet collection by any method, code name, collection item number…same error.
Error 40036 is a particularly unhelpful error, considering, the worksheet is a core excel object…
All replies
-
Do you have any VBA code in the Worksheet’s module? If so, open that module and ensure that you have Option Explicit as the very first VBA line of code before any subs and then select menu item Debug -> Compile. If it returns any errors then fix.
If compile does not return any errors then do you have a worksheet Activate event for the worksheet? If so, rename the Activate sub (Just add an underscore and any character at the end of the sub name) and then test. If you can then select then look for
an error in the Activate event.If above does not work then copy all of the code in the worksheet’s module and paste into Notebook and save as a text file as backup. Then delete all the code from the module and test again. Again if this fixes then you will need to identify the code
problem in the worksheet’s module.Also if you have Worksheet Activate code in ThisWorkbook module then need to perform similar tests.
Regards, OssieMac
-
If my previous reply does not identify a problem then try copy the used range of the worksheet to another worksheet. (Don’t use Worksheet copy as when you right click the worksheet tab name and copy because that copies any problems
with it; simply use Copy and Paste.) Rename the original worksheet and then rename the new worksheet to the old worksheets’s name and if necessary copy any associated VBA code to the new worksheets module and see if that fixes the problem.
Regards, OssieMac
- Remove From My Forums
-
Question
-
I am getting this Run time error 40036 when trying to unlock my worksheet. Works fine on another computer with same excel 365 version. Using latest 1807 version. Only happen through vba, if i manually unlock it with password, it works fine.
Here is my code to unlock:
Sheets("mysheet").Unprotect "mypassword"
I’ve tried different other way to unlock and it still throwing error.
-
Edited by
Thursday, July 26, 2018 3:06 PM
-
Moved by
Winnie LiangMicrosoft contingent staff
Friday, July 27, 2018 5:58 AM
-
Edited by
Господа, возникла следующая неприятная ситуация. Имеется две машины с одинаковыми осями (XP SP2) и офисом (97), все устанавливалось с одного дистрибутива, компоненты офиса — одни и теже. Но… следующий простой код:
- Код: Выделить всё
Dim objXl As Object
Set objXl = CreateObject("Excel.Application")
objXl.Workbooks.Open "E:Tempnew.xls"
objXl.Visible = True
b = objXl.ActiveSheet.Name
ba = objXl.ActiveSheet.Cells(1, 1).Value
objXl.Application.Quit
Set objXl = Nothing
на одной машине выполняется на раз (как, в прочем, и на других), а на той которой надо, на строке 5 или 6 выдается ошибка 40036, «Ошибка, определяемая приложением или объектом».
Стороки приведены для примера, ошибка вылетает при любой попытке что-либо прочитать/записать. Одинаковое поведение и в word и в excel.
Буду признателен за любые мысли по исправлению ситуации без переустановки офиса/оси.