By Uwe Steden on Monday, 15 June 2020
Posted in VBA Development
Likes 0
Views 783
Votes 0
Hello everybody,

I would like to rename a project after removing the copy protection (through VBA).
The renaming only works if the copy protection of the project is removed before the macro run.
When I remove the copy protection through the macro I get the error that the attribute (which I want to change) is set on the "Read Only" flag.

What am I missing here?


Sub rename_project()

'Dim StartObjProj As ObjectItem
Dim pProj As Project
Dim str1 As String
Dim str2 As String

'Set StartObjProj = Application.Selection.Item(1)
Set pProj = Application.Selection.Item(1)

str1 = pProj.Attributes.Find(5)
str2 = " (IN BEARBEITUNG)"

pProj.State = aucProjectStateShared

pProj.Attributes.Find(5).WriteProtected = False
pProj.Attributes.Find(5).Value = str1 & str2
pProj.Store

End Sub



greeting
Uwe Steden
View Full Post