ActiveProject in Project_Open event

D

DC

In the last couple of days in the Project Open event, the
ActiveProject object is NOTHING.... But this was not
happening two days back.... any ideas as to why ???

Thanks in adv,
Deepu
 
R

Rod Gill

Hi,

That is only likely to happen if Project is open but has no open or active
projects.

--
Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 
D

DC

Gill, why is that the Project Plan is not visible in the
window when the code inside the Project_Open event is
executed. Because the project plan is not visible am not
able to use methods like SelectRow/SelectCell ??
I have certain macros that needs to be executed on opening
a project and it will change some of the values of certain
tasks, those tasks which was changed will be colored in
blue. But because the project plan is not visible, I
cannot use SelectRow/SelectCell to color the modified
tasks...

btw, thanks for ur answer to my earlier question.

Deepu
 
R

Rod Gill

Hi,

The event is happening before the project is fully open. Note that the
syntax of the open event is:
Private Sub Project_Open(ByVal pj As MSProject.Project)

pj refers to the project being opened, so you don't need activeproject.
pj.Tasks(2) will still point to task with ID=2.

You can't select cells but you can mark them. Use: pj.Tasks(2).Marked = True

Then in Project once the file is open, select Format, Text Styles. Select
Marked from the drop down list and enter a format. This will only be for the
text, not background, but it does work.

Now all changes are automatically flagged just by setting a task to marked.
You can have a close event that clears all Marked flags to false.

--
Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 

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