|
|
|
date: Tue, 16 May 2006 16:33:51 -0700,
group: microsoft.public.project.pro_and_server
back
VBA runtime error 1100
I am trying to customize a Project Pro file with some VBA code.
Specifically, I want to change the color of a task based on a user's entry
in a text column. I've attached some code to the ProjectBeforeTaskChange
event. The event fires just right but I do not seem to be able to address
the SelectRow property from the Application project without generating an
error. Here is the code:
----------- MyEvents (Class Module)
Public WithEvents App As Application
Private Sub App_ProjectBeforeTaskChange(ByVal tsk As Task, ByVal Field As
PjField, ByVal NewVal As Variant, Cancel As Boolean)
If Field = pjTaskText1 Then
TaskText = NewVal
If TaskText = "Active" Then
App.SelectRow row:=tsk, RowRelative:=False
Font Color:=1
Else
App.SelectRow row:=tsk, RowRelative:=False
Font Color:=4
End If
End If
End Sub
------------- MyModule (Module)
Dim AppEvents As New MyEvents
Sub BindEventToApplication()
Set AppEvents.App = Application
End Sub
The lines App.SelectRow row:=tsk, RowRelative:False always generate this
error:
Run-time error 1100:
The method is not available in this situation
I have verified that the variable App is indeed accessable in the event. For
example, code such as "i = App.Projects.Count" operates just fine.
I am stumped and must be missing something obvious, help anyone?!
Jib
date: Tue, 16 May 2006 16:33:51 -0700
author: Tuva
Re: VBA runtime error 1100
Hi Jib,
Try posting on the developer newsgroup as this one is closing down. Please
see FAQ Item: 24. Project Newsgroups. FAQs, companion products and other
useful Project information can be seen at this web
address:http://project.mvps.org/faqs.htm .
Mike Glen
Project MVP
Tuva wrote:
> I am trying to customize a Project Pro file with some VBA code.
> Specifically, I want to change the color of a task based on a user's
> entry in a text column. I've attached some code to the
> ProjectBeforeTaskChange event. The event fires just right but I do
> not seem to be able to address the SelectRow property from the
> Application project without generating an error. Here is the code:
>
> ----------- MyEvents (Class Module)
> Public WithEvents App As Application
> Private Sub App_ProjectBeforeTaskChange(ByVal tsk As Task, ByVal
> Field As PjField, ByVal NewVal As Variant, Cancel As Boolean)
>
> If Field = pjTaskText1 Then
> TaskText = NewVal
>
> If TaskText = "Active" Then
> App.SelectRow row:=tsk, RowRelative:=False
> Font Color:=1
> Else
> App.SelectRow row:=tsk, RowRelative:=False
> Font Color:=4
> End If
> End If
>
> End Sub
>
> ------------- MyModule (Module)
> Dim AppEvents As New MyEvents
>
> Sub BindEventToApplication()
> Set AppEvents.App = Application
> End Sub
>
>
> The lines App.SelectRow row:=tsk, RowRelative:False always generate
> this error:
>
> Run-time error 1100:
> The method is not available in this situation
>
>
> I have verified that the variable App is indeed accessable in the
> event. For example, code such as "i = App.Projects.Count" operates
> just fine.
> I am stumped and must be missing something obvious, help anyone?!
>
> Jib
date: Wed, 17 May 2006 11:36:58 +0100
author: Mike Glen glenATmvps.org
|
|