dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Office Automation of MS Project

  1. #1
    Join Date
    Aug 2001
    Posts
    1,447

    Office Automation of MS Project

    I have a program in VB6 that gets at the data in MS Project, but I have some serious problems as documented in the comments in the sample code here:

    Private Sub cmdDOIT_Click()
    Dim mppfilename As String
    Dim p As MSProject.Project

    mppfilename = App.Path & "\VT.mpp"
    Set p = GetObject(mppfilename)
    '
    ' the following displays the correct number of resources and tasks
    '
    MsgBox p.Resources.Count & " resources" & vbCrLf & p.Tasks.Count & " tasks"
    '
    ' BOTH of the following display the correct resource name
    '
    MsgBox p.Resources(1).Name
    MsgBox p.Resources.Item(1).Name
    '
    ' BOTH of the following statements result in the same error message:
    '
    ' "object variable or With block variable not set"
    '
    MsgBox p.Tasks(1).Name
    MsgBox p.Tasks.Item(1).Name
    '
    ' additional problem: cannot figure ANY way to access the assignment table
    '
    End Sub

    If anyone can help me figure out why I have these two problems, I will appreciate it.

    Thanks for looking.

    Paul
    phinds
    vs2008, 3.5SP1 Version 9.0.21022.8 RTM

  2. #2
    Join Date
    Aug 2001
    Posts
    1,447

    Re: Office Automation of MS Project

    oops ... figured out the task problem ... just stupidity on my part

    BUT ... the lack of access to the assignments table remains a problem
    phinds
    vs2008, 3.5SP1 Version 9.0.21022.8 RTM

  3. #3
    Join Date
    Aug 2001
    Posts
    1,447

    Re: Office Automation of MS Project

    OK ... I've got it now. Access to certain tables via VB6 is NOT the same as access to those tables via VBA within MS Project. The assignments table for exampe, cannot be accessed directly but rather has to be gotten at indirectly, one resource at a time. This adds an awkward step to the processing, but at least it IS possible.

    Hope my floundering around was helpful to someone else out there.
    phinds
    vs2008, 3.5SP1 Version 9.0.21022.8 RTM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)