Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use VFP 6 with MS Project 4.0, 98, 2000
Message
 
 
To
05/10/2001 14:51:15
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00564956
Message ID:
00564965
Views:
23
>Does anyone know how to use VFP 6.0 with MS Project 4.0, 98 and 2000 simultaneously? I am trying to access several dbf files in the dbc, create a Read/Write SQL, then send it to a MS Proejct mpp file so the users can open it up in the hightest possible version of MS Project they have loaded on their pc (default association) and make changes to the data then save it back to the database. The problem I am having is that Microsoft says they are not supporting dbfs in Project 98 and 2000 :(. Does anyone have an idea of what I should do and/or a sample or URL?
>
>Here are the Microsoft sites to non-support of dbfs for MS Project /www.microsoft.com/Office/Project/PRK/2000/Five/67ct_3.htm
>and MS Project 98 http://www.microsoft.com/office/project/support/98.htm.
>
>Thank you.


I would recommend using OLE automation of MS Project for all three versions. You could create an MPP file based on the data retrieved. They could open the MPP file, manipulate it and then when you get it back, open the MPP file and query it via its object model (see VBAPJ?.CHM/VBAPJ?.HLP).

The object model hasn't changed much over the versions for the basics. Obviously, 98/2000 has more stuff in it than 4.1. does. However, if you have to support the lowest common denominator, you should be okay.

There isn't much in the way of documentation on this. One article is MSKB#Q143297. Here is some sample code (written using VFP 7 but the principle is the same):
#DEFINE pjASAP	0	
#DEFINE pjALAP	1	
#DEFINE pjFNET	6	
#DEFINE pjFNLT	7	
#DEFINE pjMFO	3	
#DEFINE pjMSO	2	
#DEFINE pjSNET	4	
#DEFINE pjSNLT	5	

#DEFINE pjFixedUnits	0	
#DEFINE pjFixedDuration	1	
#DEFINE pjFixedWork	2	

local lomsapp as MSProject.Application, lomstask as MSProject.Task, lomsres1 as MSProject.Resource, ;
	lomsres2 as MSProject.Resource, lomsproj as MSProject.Project

lomsapp = createobject('msproject.application')

With lomsapp
	lomsproj = lomsapp.Projects.Add(.F.,'',.F.)
	With lomsproj
		.Name = 'Test Project'
	Endwith
	
	lomsres1 = lomsproj.Resources.Add('Employee 1')
	With lomsres1
		.CostRateTables('A').PayRates.Add(date(),40.00,80.00,0.00)
	Endwith

	lomsres2 = lomsproj.Resources.Add('Employee 2')
	With lomsres2
		.CostRateTables('A').PayRates.Add(date(),40.00,80.00,0.00)
	Endwith

	lomstask = lomsproj.Tasks.Add('Summary')
	lomstask = lomsproj.Tasks.Add('Task 1')
	With lomstask
		.Start = date()
		.Duration = '14d'
		.Type = pjFixedUnits
		.ConstraintType = pjMSO
		.EffortDriven = .T.
		.WBS = '1.1'
		.Assignments.Add(,lomsres1.ID,.5)
		.Assignments.Add(,lomsres2.ID,.75)
		.OutlineIndent()
	Endwith
	
	lomstask1 = lomsproj.Tasks.Add('Task 2')
	With lomstask1
		.Start = lomstask.Finish
		.Duration = '4d'
		.EffortDriven = .F.
		.WBS = '1.2'
		.Assignments.Add(,lomsres1.ID,1)
		.Assignments.Add(,lomsres2.ID,1)
		.LinkPredecessors(lomsproj.Tasks("Task 1"),1,'0d')
	Endwith

	? lomsproj.Cost

	.Visible = .T.
	.FilePrint(1,1)
	.Quit(0)
Endwith
HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform