Linking to a resource pool

D

Dan

I have a number of projects that all use resources from a common resource
pool project. I am writing a VB program that will automate adding new
projects that also use this resource pool. I know how to open a project file,
change things like task names and project start dates. I would also like to
assign the resource pool name to the resource pool project. However, the
ResourcePoolName property is read-only. How do I set this property? Can
someone help me with a snippet of code to accomplish this? Thank you!

Dan
 
D

Dan

Jan,

Thank you! That's helpful. But I'm not quite sure of the context in which I
use this statement. It looks like ResourceSharing is a method of the Project
application variable. Do I put this statement before I loop on the individual
project files that I want to use the resource pool? Do I simply open and save
each of these project files, and the resource sharing will be set
automatically? Do I have to do anything with the resource pool project?

Please pardon my ignorance. This is a new area of VB programming for me. I
appreciate your help.

Dan
 
J

Jan De Messemaeker

Hi,

Why didn't you have a quick look on the Object Browser or other help?
ResourceSharing is a function on application level but it acts on the
activeproject so
FileOpen...
ResourceSharing...
FileClose pjsave

Mind you, the Pool has to be open all of the time!
 
D

Dan

Jan,

Thanks again for your help.

Actually, I did look at the Object Browser, but I've never figured out how
to get more help from it than simply the list of properties, methods, etc. If
you have any suggestions or pointers for how I can get more useful help from
it, I'd be glad to listen.

Dan
 
D

Dan

Jan,

Do I open the resource pool project with the pjPoolReadWrite contant? Do I
open the individual projects without any pjPool constant?

I have the FileOpen, ResourceSharing and FileClose statements in a loop, and
before that loop I have a FileOpen on the resource pool project. When I exit
the loop, does the resource pool project become the active project? After the
loop, I have another FileClose with pjSave to save the resource pool, but it
tells me that that statement is not valid in that situation. I'm wondering
how to save the resource pool project.

Dan
 
J

Jan De Messemaeker

Hi,
The day somebody from Microsoft pointed me towards the Object Browser I
started using VBA professionally.
F.i. type "sharing", get anything on resoruce sharing, click the
questionmark and know all about it..
Sometimes you absolutely don't know any keyword, then record a macro to gert
a hint.
HTH
 
J

Jan De Messemaeker

Hi,

You open the pool beforehand as read/write since you want to save all the
links you are
putting into it.
You even can't open it from the open of the files since they are not yet
linked to it.
Thus when you open the individual files the parameter openpool is
meaningless.
Hope this helps,
 
D

Dan

Jan,

When I click on "ResourceSharing" in the "Members of 'Application'" column
in the Object Browser and then click on the"?", I get an error: "Unable to
display help." All I get is the short description of the function in the
small window below the "Classes" and "Members" columns. Am I missing some
help files? Do I need to reinstall part of VB?

I have one further question that hasn't been answered concerning linking
projects to a common resource pool project. How do I save the resource pool
project? My flow is as follows:

FileOpen resource pool

Do
FileOpen project file
ResourceSharing
FileClose pjSave
Loop Until ...

FileClose pjSave ' resource pool

Before this final FileClose, do I need to make that project active? If so,
how do I do that? As is, it tells me that the final FileClose is not valid in
this situation.

Thanks again for your help!

Dan
 
J

Jan De Messemaeker

Hi,

In principle yes, fileclose works on the activeproject, but with the flow
described the pool is the only project left open so it can't but be teh
active project.

If you have to activate a project one way ois as follows
-When opening
FileOpen "TheAddress"
set AnyPrName=activeproject

- When activating
AnyPrName.activate

Hope this helps,
 
D

Dan

Jan,

I don't know what I'm doing wrong, but I keep getting errors when I try to
save the resource pool project. After my loop on the other projects, I added
the statement

ResourcePoolProj.Activate

That gives me error 1004: "An unexpected error occurred with the method."

When I comment out that line, I get error 1100 on the "FileClose pjSave"
statement: "The method is not available in this situation."

I don't know what else to try. I have put debug messages before the
FileClose statement for the resource pool, and the number of projects in the
Projects collection is 1 and its name is the name of the resource pool
project. Any other suggestions for figuring out what it doesn't like and how
to fix the problem?

Dan
 
J

Jan De Messemaeker

Hi,

OK, I now remember that you get an error when trying to activate an already
active project so the activate statement is unnecessary here.

Should you ever want to use it put before
if not activeproject.fullname=resourcepoolproject.fullname then
(Activate)
end if

OBTW forgot to reply about the help files. I see this with some customers,
never had it when I made a full install of Project. I think some IT
services, when installing Project, leave out some components on purpose, why
noone will ever know.

Now to the point I have a hard time imagining. Is the directory where you
save the pool read/write? Doesn't it have the "read only preferred"
property?
I see no problem in your code

But just to make sure .... YOU AREN'T USING SERVER are you?

Greetings,
 
D

Dan

Jan,

I'm not using the server edition of Windows or Project. I'm on a standalone
Windows XP Professional system using Project 2000. I installed Project on
this system. It was long enough ago that I don't remember if I left out any
parts of it, but if I did it wasn't deliberate. I suppose I could go back and
reinstall just to make sure it's all there.

The folder where I'm trying to save the resource pool project is the same
folder where all the other project files are being saved. It's not read-only.

Dan
 
J

Jan De Messemaeker

Ha, that already says something more.
Project 2000, if memory serves me, had an option for a "typical" install:
VBA help wasn't included.
And have you ever installed the service release? There were some Resource
Pool problems that were solved by it.
 
D

Dan

Jan,

I tried reinstalling Project 2000, selecting all the options for VB and VBA
help. I still cannot access the help in the Object Browser. I also tried the
Repair option in the installation program. The only thing I did not try was
uninstalling the program completely and then reinstalling it.

I also downloaded and installed Service Release 1 for Project 2000. It
didn't seem to make any difference in the execution of my code. I still get
the same error when I try to save the resource pool.

Dan
 
R

Rod Gill

Try recording a macro of you manually linking to the resource pool. That
will give you your code.
 
D

Dan

Rod,

That was an excellent suggestion that I had totally forgotten about trying.
The macro recorded a "WindowActivate" statement before closing the resource
pool, and that solved the problem in my program. Thanks for the suggestion!

Dan
 

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