How to copy a task with VB

H

Hugues Perron

Hi, I need to create a sub-project from a master project based on some
criteria (I won't use the filters on Project beacause I really need two
project files).

So I'm writing a program that creates a new project and copy the selected
tasks in it. The problem is I need to copy all the information (including
the actuals, the predecessors, etc...). Is there a way to copy all the
information of a task (like a Copy & paste) or do I have to copy each field
(which is a complex and long task) of the task.

I use VB, not VBA, the program must be stand alone.

Help will be very appreciated.

Thanks

Hugues
 
J

Jan De Messemaeker

Hi Hughes,

It is not "like copy and paste"

It IS copy and paste
Lookup the Project methods SelectRow, EditCopy and EditPaste.
HTH

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
Project Management Consultancy
Prom+ade BVBA
32-495-300 620
 
G

Gérard DUCOURET

Hello Hugues
Try the following process :
- Select all the tasks by clicking on their ID number.
- Edit / Copy
- Switch to the new porject : Edit / Paste

Gérard Ducouret
 
H

Hugues Perron

Hi Jan,

Thanks for your answer, but it's not exactly what I need. As I said, I'm
trying to develop a program in Visual Basic (not in the macro editor) to be
able to run in a stand alone environement (without launchin MS Project) I
think SelectRow is avaiable in the macro environement. If I'm wrong, can you
give me a little example to show me hoe the selectRow works.

Thanks

Hugues
 
H

Hugues Perron

Bonjour Gérard,

Pour le bénifice de tous les francophones, parlons un peu français... ;-))

C'était une bonne idée, mais ça ne fonctionne pas tout à fait. En fait c'est
une sous-ensemble du projet que je veux. Je peux faire afficher seulement
les tâches que je veux (avec un filtre) et toutes les sélectionner, mais si
je copie le tout dans un autre projet, même les tâches qui n'étaient pas
visibles sont copiées.

Ce que je veux faire c'est une programme en Visual Basic (et non en VBA) qui
me permet de copie seulement les tâches que je sélectionne. Mais en VB faire
une copie d'une tâche ne me semble pas évident. J'imagine que c'est
possible, mais je ne sais pas comment du tout.

Hugues
 
G

Gérard DUCOURET

Bonjour Hugues,
Dans ce cas, il faut éviter le copier/coller.
Repérer en VBA toutes les tâches qui répondent au critère voulu et prélever leurs données : nom,
durée, coût... Une telle procédure en VBA serait facile à écrire, mais je ne sais pas comment un
programme VB peut activer une procédure VBA dans un fichier Project .mpp.

So the final question is "How a VB program can run a VBA procedure in a mpp file ?"

Gérard Ducouret
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top