"50289 The operation cannot be completed because the project is protected," but why?

I provide the correct password

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("H:\M\X\C.xls", 0, , , "password")

'any of these lines causes the mentioned error

Set vbcomp = objWorkbook.VBProject.VBComponents(modname)
objWorkbook.VBProject.VBComponents.Remove vbcomp
objWorkbook.VBProject.VBComponents.Import modpath & modtest

Any ideas what might be the problem? Tools-Macro-Security is configured to allow access to the VB project

+4
source share
3 answers

The VBA project itself is password protected, which is different from the worksheet password. Open the VBA IDE - select Tools-VBA Project Properties and view the Protection tab.

Not sure how or remove the password of the VBA project using code.

+5
source

, , Windows Installer ( msicuu2.exe Google) 2003. 2003, . , . Alex

0

, , !

, , , , , . , , , .

0

Source: https://habr.com/ru/post/1706393/


All Articles