Turning Gridlines-Gantt Rows On and Off

M

Michael

I am writing a simple macro that turns on or off the horizontal
Gridlines-Gantt Rows in the Gantt Chart view. I can turn them on and off
using two separate macros. However, what I would like do is create one macro
so I can attach it to one icon that will then toggle the lines on and off.

The macro below will address the NormalType variable in the first if
statement, but I can't get it to address the NormalType in the ElseIf
statement. I have tried several different variations and none of them work.

If NormalType = 0 Then 'If lines are off, turn them on.
GridlinesEdit Item:=0, NormalType:=1
GridlinesEdit Item:=0, NormalColor:=15
ElseIf NormalType <> 0 Then 'If lines are on, turn them off.
GridlinesEdit Item:=0, NormalType:=0
GridlinesEdit Item:=0, NormalColor:=16
End If
 
J

Jack Dahlgren MVP

I think that that gridline properties are write only.
There are a few options:

1) Keep doing it with separate macros for on and off.
2) Store the gridline state in a project level variable or registry setting
(note, this won't be consistent if the user changes gridline settings
manually or switches views)
3) Make a single macro which randomly selects one of the two settings. User
could click the button until it changes the way they want. It might be one
click or maybe it would take serveral...
4) Predefine a view with gridlines and a view without gridlines and use your
macro to toggle between the two views.


-Jack Dahlgren
 
M

Michael

Jack,

Thanks for providing all of the options. I think I am going to have to stick
with option one as we have several different users, tables, and views using
this so I need to keep it as flexible as I can. Thanks again for the info.

Michael
 
J

Jan De Messemaeker

Hi,

Oh...

You thought Normaltype would be supplied by the system???
It won't, gridlines as Jack says are writeonly
I explicitly asked whether normaltype was a variable you controlled: if it
isn't you indeed atre an the wrong track, sorry.
HTH

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

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