J
JCB
I'm trying to export some data from an Access form to msProject, with the
code I presente below.
The first time I run the code it runs fine; the seconde time it gives me an
error message; the third time it runs fine again, and so on.
The error message is "The remote server machine does not exist or is
unavailable (Error 462)", and it stops at the line "Set Proj = ActiveProject"
Can anyone please tell me wath is th problem with my code?
Private Sub Command4_Click()
Dim projApp As MSProject.Application
Dim Proj As MSProject.Project
Dim varItem As Variant
Set projApp = CreateObject("MSProject.Application")
projApp.Visible = True
projApp.FileNew
Set Proj = ActiveProject
'Manipulating project
ProjectSummaryInfo Start:="01-01-2008"
For varItem = 1 To (Me.List5.ListCount - 1)
SelectTaskField Row:=1, Column:="Name"
SetTaskField field:="Name", Value:=Me.List5.Column(2, varItem)
SetTaskField field:="Start", Value:=Me.List5.Column(3, varItem)
SetTaskField field:="Finish", Value:=Me.List5.Column(4, varItem)
Next varItem
'Close project
'projApp.FileClose pjSave
'projApp.Quit
Set projApp = Nothing
Set Proj = Nothing
End Sub
code I presente below.
The first time I run the code it runs fine; the seconde time it gives me an
error message; the third time it runs fine again, and so on.
The error message is "The remote server machine does not exist or is
unavailable (Error 462)", and it stops at the line "Set Proj = ActiveProject"
Can anyone please tell me wath is th problem with my code?
Private Sub Command4_Click()
Dim projApp As MSProject.Application
Dim Proj As MSProject.Project
Dim varItem As Variant
Set projApp = CreateObject("MSProject.Application")
projApp.Visible = True
projApp.FileNew
Set Proj = ActiveProject
'Manipulating project
ProjectSummaryInfo Start:="01-01-2008"
For varItem = 1 To (Me.List5.ListCount - 1)
SelectTaskField Row:=1, Column:="Name"
SetTaskField field:="Name", Value:=Me.List5.Column(2, varItem)
SetTaskField field:="Start", Value:=Me.List5.Column(3, varItem)
SetTaskField field:="Finish", Value:=Me.List5.Column(4, varItem)
Next varItem
'Close project
'projApp.FileClose pjSave
'projApp.Quit
Set projApp = Nothing
Set Proj = Nothing
End Sub