I need to change scheduling information in MS Project quite often, particularly the way duration and work is displayed. In discussion with team members we use “days”, talking to financial people requires “hours”. The following macro toggles between both worlds. No need to click thru menus anymore.
Oddly, you cannot read the current status in MS Project, so we use a little detour and use the Manager
property instead. No one needs him that, anyway. A very first use of the macro may thus not work as expected, all subsequent uses just work fine.
Option Explicit Sub swaToggleHoursDays() Dim dummy As Integer If ActiveProject.BuiltinDocumentProperties("Manager") = "" Then ActiveProject.BuiltinDocumentProperties("Manager") = CStr(pjHour) End If dummy = CInt(ActiveProject.BuiltinDocumentProperties("Manager")) If dummy <> pjHour Then OptionsSchedule DurationUnits:=pjHour, WorkUnits:=pjHour ActiveProject.BuiltinDocumentProperties("Manager") = CStr(pjHour) Else OptionsSchedule DurationUnits:=pjDay, WorkUnits:=pjDay ActiveProject.BuiltinDocumentProperties("Manager") = CStr(pjDay) End If End Sub