B
Biggles
I run a VBA sub to update actual time in assignments. I then want to open
each plan in a Project database to allow Project to calculate the task actual
time and time remaining, and the percentage work completed. Then I want to
close the plan. I will then, using VBA, change the actual and remaining
duration, and the pct complete. I have a question about the second part.
I am reading Rod Gill's book, and he gives an example of how to control
Project from Excel. I want to change it and control Project from Access.
When I run this:
Sub OPENANDSAVE()
Dim projapp As MSProject.Application
Dim v_PROJ_FILE As String
'On Error Resume Next
'On Error GoTo 0
Set projapp = GetObject(, "MSProject.Application")
If projapp Is Nothing Then
Set projapp = CreateObject("MSProject.Application")
End If
Set rs(5) = New ADODB.Recordset
ssql(9) = "SELECT PROJ_ID, PROJECT_NAME FROM MSP_PROJECTS WHERE PROJ_ID
< 7 "
rs(5).Open ssql(9), conn_proj
Do Until rs(5).EOF
v_PROJ_FILE = "<" & proj_db & ">\" & rs(5)!PROJECT_NAME
Debug.Print v_PROJ_FILE
projapp.FileOpen Name:=v_PROJ_FILE, FORMATID:="MSPROJECT.MPD",
ReadOnly:=False
projapp.Visible = True
projapp.FileClose pjSave
rs(5).MoveNext
Loop
Set projapp = Nothing
End Sub
At the getobject line, I get the error 429
ActiveX component can't create object.
What do I need to do?
each plan in a Project database to allow Project to calculate the task actual
time and time remaining, and the percentage work completed. Then I want to
close the plan. I will then, using VBA, change the actual and remaining
duration, and the pct complete. I have a question about the second part.
I am reading Rod Gill's book, and he gives an example of how to control
Project from Excel. I want to change it and control Project from Access.
When I run this:
Sub OPENANDSAVE()
Dim projapp As MSProject.Application
Dim v_PROJ_FILE As String
'On Error Resume Next
'On Error GoTo 0
Set projapp = GetObject(, "MSProject.Application")
If projapp Is Nothing Then
Set projapp = CreateObject("MSProject.Application")
End If
Set rs(5) = New ADODB.Recordset
ssql(9) = "SELECT PROJ_ID, PROJECT_NAME FROM MSP_PROJECTS WHERE PROJ_ID
< 7 "
rs(5).Open ssql(9), conn_proj
Do Until rs(5).EOF
v_PROJ_FILE = "<" & proj_db & ">\" & rs(5)!PROJECT_NAME
Debug.Print v_PROJ_FILE
projapp.FileOpen Name:=v_PROJ_FILE, FORMATID:="MSPROJECT.MPD",
ReadOnly:=False
projapp.Visible = True
projapp.FileClose pjSave
rs(5).MoveNext
Loop
Set projapp = Nothing
End Sub
At the getobject line, I get the error 429
ActiveX component can't create object.
What do I need to do?