Working time

G

giugio

Hy.
How to get with vba the working time periods added in the working time tab
of the resource?
thanks.
 
G

giugio

Jan De Messemaeker said:
Hi,

activeproject.Resources("JDM").Calendar.Period("1/5/2000").shift1.Start
as an example.
Identical for Finish, and for Shift2, etc.
HTH

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
thanks , but with this i get always 8:00-13.00 ecc... the default calendar.
but how to get the nondefault working time that i've setted?9.00-13.00
 
J

Jan De Messemaeker

Hi,

Sorry, Not true.
You get the calendar for the resource (I thought that was what you needed)
Look at the resource sheet to check which base calendar your resources use.
If the instruction shows the default then the resoruce calendar is the
default.

If you want the hours of an other base calendars :

Activeproject.basecalendars("My Calendar").period... etcetera

Hope this helps,

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
G

giugio

Jan De Messemaeker said:
Hi,

Sorry, Not true.
You get the calendar for the resource (I thought that was what you needed)
Look at the resource sheet to check which base calendar your resources use.
If the instruction shows the default then the resoruce calendar is the
default.

If you want the hours of an other base calendars :

Activeproject.basecalendars("My Calendar").period... etcetera

Hope this helps,

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
thanks.
the calendar indeed is the default calendar , but the "set selected date(s)
to" is not the "use default" but the "nondefault working time".
indeed if i try to set a date thath isn't the default ,the dialog set the
nondefault working time radio but if i run this in vba:
Message
(CStr(ActiveProject.Resources("testresource").Calendar.Period("1/5/2000").Shift1.Start))
show the first time of the default working time.
thanks.
 
G

giugio

I'm only set a default time work between 9.00 and 13.00 in all the year , not
setting one day x one day set.
How?
 
J

Jan De Messemaeker

The whole question is, IN WHICH CALENDAR did you change the working time?
From your posts I suddenly got the imprssion that you think there is onlmy
one calendar in Project. You can have many base calendars (Project gives
yopu 3 for starters , "Standard", "Night Shift" and "24 hours" but by Change
Working time, New, you can create as many as you like.
You then have to decide which of the base calendars is to be your project
calendar (select that in Project menu, Project information) and which base
calendar is to be the base for each resource calendar.
Then you can adapt each resource calendar individually (for instance
individual days off).

I CANOT really help you as long as you cannot identify wjhich calendar you
want to read in VBA

So through VBA you can address each of these calendars.
Once you got the right calendar the method is
Therightcalendar.PERIOD(thedate).SHIFT1.START
in capital letters are the VBA keywords; the remainder is up to you.
Look up the VBE Objet Browser for BaseCalendars and the Calendar object.

But finally.. maybe a personal opinion, but I thoink it os hopeless to try
to write Project VBA without knowing Project ands understanding its objects.

Hope this helps,
--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
G

giugio

Jan De Messemaeker said:
The whole question is, IN WHICH CALENDAR did you change the working time?
From your posts I suddenly got the imprssion that you think there is onlmy
one calendar in Project. You can have many base calendars (Project gives
yopu 3 for starters , "Standard", "Night Shift" and "24 hours" but by Change
Working time, New, you can create as many as you like.
You then have to decide which of the base calendars is to be your project
calendar (select that in Project menu, Project information) and which base
calendar is to be the base for each resource calendar.
Then you can adapt each resource calendar individually (for instance
individual days off).

I CANOT really help you as long as you cannot identify wjhich calendar you
want to read in VBA

So through VBA you can address each of these calendars.
Once you got the right calendar the method is
Therightcalendar.PERIOD(thedate).SHIFT1.START
in capital letters are the VBA keywords; the remainder is up to you.
Look up the VBE Objet Browser for BaseCalendars and the Calendar object.

But finally.. maybe a personal opinion, but I thoink it os hopeless to try
to write Project VBA without knowing Project ands understanding its objects.

Hope this helps,
--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf



you are very nice jan , thanks.
I resolve :
I use general working hours under project menu.
THis set all the days with the new hours.
Your code in vba work perfectly thanks a lot.
By.
 

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