Jul 29 2023 05:59 AM
Error on Task object in Excel VBA : Object required
Hello I don't understand why the Task object gives me an error, maybe I should add a reference to the excel project, but I haven't found any suggestions online.
Please can someone help me?
Below I attach the Sub that gives me the error :
Sub SetOutline()
Dim TaskName As String
Dim Temp As Long
For Temp = 1 To ActiveProject.Tasks
MsgBox "Task: " & ActiveProject.Tasks(Temp).Name & vbCrLf
Next
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
t.OutlineLevel = t.Text1
End If
Next t
End Sub
Tanks a lot
Fabrizio
Jul 29 2023 06:24 AM
The code that you posted is for Microsoft Project.
If you want to run it from Excel, you will have to create a Project.Application object and open or create a project object.
You cannot simply refer to ActiveProject in Excel VBA because ActiveProject is not an Excel object.
Aug 05 2023 02:29 AM