Title: How to rename a vbproject with code VBA
Tags: vba;excel;macros
Question: I am trying new stuff on Excel, among which is file manipulation.
I am trying to change the name of a project within a new file I've just created
I tried this code :
Workbooks("Book1").VBProject.Name = "tototot"
but it doesn't work.
Can you help me please?
Comment: Your code works for me - do you have trusted access to the VBA Project set in your trust center settings?

Comment: Yes, that was that. It worked after I ticked the box "trust access to the vba project object...". Thank you

Here is the accepted answer: application.VBE.ActiveVBProject.Name="testmodel"
Comment for this answer: Sure, I did add to check the permissions, then I took it away, I thought it might open up network permission connotations :)  glad you've sorted it.
Comment for this answer: Thanks, it looked promising, but it didn't work, the name of the project is still VBAProject :/
Comment for this answer: after I ticked the box "trust acces to the vba project..." it works fine. TY


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:06/21/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<vba><excel><macros>', 'Title': 'How to rename a vbproject with code VBA', 'ViewCount': 1065, 'id': 37941880, 'user_AboutMe': '<p>Graduate of the University of Montpellier, my first job was in a startup as a Data Miner, where I mostly used R and Excel. \nAt the university, R is what I used most, then a little of SAS, and SPSS.\nAt my first job, it was R and Excel/VBA.</p>\n\n<p>I like learning, this is why I decided to dip my toes into VBA and also Python.\nMy hobbies include being a TV Enthusiast, a movies somewhat enthusiast, a bike newbie (the VTT kind, not the motor kind) and a board game enthusiast.</p>\n', 'user_AccountId': 6336184.0, 'user_DisplayName': 'Amandine FAURILLOU', 'user_Reputation': 518.0, 'user_Views': 135.0, 'user_id': 4919504.0}}