lock columns

A

Anne

Sorry, I pressed "Space" and the the posting was sent even
if it was not complete.
I used this code and do not know how to leave it after I
tried to edit a new date, because it is impossible to do
anything, I have to close Project with the task manager!
How can I get out of it after the messagebox appeared? I
tried "exit sub" but it is ignored.

Private Sub appl_ProjectBeforeTaskChange2(ByVal tsk As
Task, ByVal Field As PjField, ByVal NewVal As Variant,
ByVal Info As EventInfo)
If Field = pjTaskDate2 Then
MsgBox "The date may not be changed!",
vbCritical
Info.cancel = True
End If
End Sub

Anne
 
J

Jan De Messemaeker

Hello Anne,

Replace VBcritical by
(VBcritical+VBOKonly)

Your message box will then have an OK button

OBTW, I was surprised to read

ByVal Field as pjfield
Shouldn't that be
ByVal Field as Long (or Integer or Variant)?

Gruesse

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
Project Management Consultancy
Prom+ade BVBA
32-495-300 620
 
A

Anne

Hi Jan,

I'm sorry, your proposal is no amelioration :-( If I
confirm "ok" and click to another column the messagebox
appears again and again and no menu is activated...very
strange! I can't get rid of the messagebox!
ByVal Field as pjfield is predefined and if I change the
values I get the message that it may not be changed.

Anne
 
J

Jan De Messemaeker

Hi Anne,

Sorry my reply took a few days, I first had to get acquainted to events...
didn't know exactly how to fire them

I think youdr definition and handling of the cancel variable are to blame;
By all means, the following works without looping:

Private Sub PjApp_ProjectBeforeTaskChange _
(ByVal tsk As Task, _
ByVal Field As PjField, _
ByVal NewVal As Variant, _
Info As Boolean)
If Field = pjTaskDate2 Then
MsgBox "The date may not be changed!", _
vbCritical + vbOKOnly
Info = True
End If
End Sub


Gruesse aus Flandern,

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
Project Management Consultancy
Prom+ade BVBA
32-495-300 620
 

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