Article ID: 143297
Article Last Modified on 9/30/2003
Field# Name Type 1. field1 - Character(10) 2. task_name - Character(25) 3. duration - Character(5) 4. start - date 5. finish - date 6. pred - Character(10) 7. resource_n - Character(20)
field1 = " " task_name = "Build House" duration = "60d" start = 03/01/96 finish = " " pred = " " resource_n = "Ace Builders"NOTE: Assign a start date to the first task only. Assign all tasks a duration. For example, 30d = thirty days. Microsoft Project will calculate the finish dates based upon the duration of each task.
CLEAR
SET SAFETY OFF
ON ERROR DO OLERROR
SET DEFAULT TO "C:\VFP Files"
PUBLIC x
IF FILE('Saltbox.mpp')
ERASE Saltbox.mpp
ERASE Saltbox.mpx
ENDIF
IF USED('k2project')
USE IN k2Project
ENDIF
USE k2project IN 0
* Microsoft Project will only accept FOX2 TYPE FILES
COPY TO xproj TYPE FOX2
USE IN k2project
Myfile = "xproj.dbf"
x=CreateObject("MSProject.Project.4_1")
x.application.Visible=.t.
x.application.FileNew
x.application.FileSaveAs("SaltBox")
* Append Entry table from Myfile
x.application.FileOpen(Myfile,0,1,1,'Entry')
x.application.SelectAll
* Link the tasks together
x.application.LinkTasks
x.application.AppMinimize
Myans =MessageBox("Print Gantt Chart?",4+32,"Print Report")
IF Myans = 6
x.application.FilePrint(1,4)
ENDIF
x.application.AppRestore
x.application.ViewApply("Pert Chart")
x.application.AppMinimize
Myans =MessageBox("Print Pert Chart?",4+32,"Print Report")
IF Myans = 6
x.application.FilePrint(1,2)
ENDIF
x.application.ViewApply("Gantt Chart")
x.application.FileSave
x.application.FileQuit
RELEASE x
RETURN
PROCEDURE OLERROR
ON ERROR
WAIT WINDOW "An error occurred!"
=AERROR(myerror)
CLEAR
? 'The error provided the following information' && Display message
FOR n = 1 TO 7 && Display all elements of the array
? myerror(n)
ENDFOR
IF TYPE("X") = "O"
x.application.Quit
RELEASE X
CANCEL
ENDIF
RETURN
Additional query words: VFoxWin
Keywords: kbcode KB143297