OLE automation with MS Project.

Hi,

Has any one done OLE automation from PB App to MSProject?? Just wondering 
what command set to use to manipulate MSProject elements from Powerbuilder. 
The MSProject VBA help and MSDN doesn't have necessary documentation. Any 
feed back / links would be highly appreciated. 

FYI - I am using PB8 and MS Project 2k.
Thanks - Rich.
0
Rich
2/24/2003 7:54:17 AM
sybase.ole-ocx-activex 6324 articles. 0 followers. Follow

1 Replies
656 Views

Similar Articles

[PageSpeed] 32
Get it on Google Play
Get it on Apple App Store

Yes.  I have just completed such a project, and it works well.

You have to look at the VBA Help file.  Contact me if you want more help: 
victora.reinhart@phs.com.

Here is some sample code.
// The following will automatically start MS Project if it is not yet 
started.  It will also reuse an existing
// MS Project application.
li_rc=goProject.ConnectToNewObject("MSProject.Application")

IF li_rc=0 THEN
        //MessageBox('OK','Worked')
ELSE
        MessageBox('Error','Please install Microsoft Project 
2002'+'~r~nReturn Code from ConnectToNewProject='+String(li_rc))
        RETURN
END IF

goProject.Visible=TRUE

//goProject.FileOpen("c:\temp\Project1.mpp")

ll_max=goProject.ActiveProject.Tasks.Count
MessageBox('No of tasks:',ll_max)

FOR ll_row=1 TO ll_max
        st_msg.text=String(ll_row)
        lo_task=goProject.ActiveProject.Tasks(ll_row)
        ls_taskname=lo_task.Name
        ls_text1=lo_task.Text1
        ls_text2=lo_task.Text2
        ls_text3=lo_task.Text3
        ls_text4=lo_task.Text4
        ls_text5=lo_task.Text5
        ls_text6=lo_task.Text6
        ls_finish5=lo_task.Finish5
        le_cost=lo_task.Cost
        ldt_start=lo_task.Start
        ls_resource_names=lo_task.ResourceNames
        li_constraint_type=lo_task.ConstraintType
 
        // Constraint Date can be a string of 'NA' or a DateTime.
        la_1=lo_task.ConstraintDate
        CHOOSE CASE ClassName(la_1)
                CASE 'string'
                        ls_constraint_date=String(la_1)
                CASE 'datetime'
                        ldt_constraint_date=DateTime(la_1)
 ls_constraint_date=String(ldt_constraint_date,'YYYY-MM-DD')
                CASE ELSE
                        ls_constraint_date=''
        END CHOOSE
        //MessageBox('Constraint Date',ls_constraint_date)
 
        ls_text7=lo_task.Text7
        ls_text8=lo_task.Text8
        ls_text9=lo_task.Text9
NEXT
0
VictorReinhart
3/18/2003 4:40:29 PM
Reply: