Rename Module via VBA

G

Guest

While running:

Sub rename_it()
ThisWorkbook.VBProject.VBComponents("Module1").Name = "new_check"
End Sub

I get a "1004" error

"Programmatic access to Visual Basic Project is not trusted"

I feel that i have earned the trust of my computer and my own files.

How do I avoid this error.

p.s. I can still re-name a module manually in the editor.
 
B

Bob Phillips

Excel 2002 added a new security setting was added whereby you must grant
access in order to manipulate objects that are part of the VBProject with
VBA.


From the menu Tools/Macro/Security, select the Trusted Sources tab and check
"Trust Access to Visual Basic Project".


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
J

joost.lenaerts

You need to change your macro security settings as follows:

Menu Tools > Macro > Security... > tab Trusted publishers > tick 'Trust
access to VBA projects'

Cheers


Gary''s Student schreef:
 
J

Joost Lenaerts

You need to change your macro security settings as follows:

Menu Tools > Macro > Security... > tab Trusted publishers > tick 'Trust
access to VBA projects'

Cheers

Gary''s Student schreef:
 
G

Guest

Thank you
--
Gary''s Student


Bob Phillips said:
Excel 2002 added a new security setting was added whereby you must grant
access in order to manipulate objects that are part of the VBProject with
VBA.


From the menu Tools/Macro/Security, select the Trusted Sources tab and check
"Trust Access to Visual Basic Project".


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
G

Guest

Thank you
--
Gary''s Student


Joost Lenaerts said:
You need to change your macro security settings as follows:

Menu Tools > Macro > Security... > tab Trusted publishers > tick 'Trust
access to VBA projects'

Cheers

Gary''s Student schreef:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top