i am trying to get the values of of some MS Project fields into MS Word but i keep getting this error "Provider cannot be found. it may not be properly installed" although everything seems to be fine, please any ideas on how to go about it.
PS: i added the Ms project library reference and also the ADO 2.6 library referenceCode:Sub ConnectLocally() Dim conData As New ADODB.Connection Dim rstAssigns As New ADODB.Recordset Dim intCount As Integer Dim strSelect As String Dim strResults As String fhre = ActiveDocument.Path part = fhre & "\timetrack.mpp" conData.ConnectionString = "Provider=Microsoft.Project.OLEDB.9.0;PROJECT NAME=" & part conData.ConnectionTimeout = 30 conData.Open strSelect = "SELECT ResourceUniqueID, AssignmentResourceID, AssignmentResourceName , TaskUniqueID, AssignmentTaskID, " & _ " AssignmentTaskName FROM Assignments WHERE TaskUniqueID > 0 ORDER BY AssignmentTaskID ASC" rstAssigns.Open strSelect, conData Do While Not rstAssigns.EOF For intCount = 0 To rstAssigns.Fields.Count - 1 strResults = strResults & "'" & _ rstAssigns.Fields(intCount).Name & "'" & _ Space(30 - Len(rstAssigns.Fields(intCount).Name)) & vbTab & CStr(rstAssigns.Fields(intCount).Value) & vbCrLf Next strResults = strResults & vbCrLf rstAssigns.MoveNext Loop conData.Close Open "C:\My Documents\Results.txt" For Output As #1 Print #1, strResults Close #1 Shell "Notepad C:\My Documents\Results.txt", vbMaximizedFocus End Sub
i appreciate your suggestions.




Reply With Quote
Bookmarks