error 424


J

James

Hi,

I'm using the following code to make some changes to a specific file on a
before save event (the code is in the enterprise global).

Private Sub Project_BeforeSave(ByVal pj As MSProject.Project)
If ActiveProject.Name = "<file I want to run code on>" Then
If vbResponse = vbNo Then
Exit Sub
End If
<code that I want to run>
End If
End Sub

This code works fine but generates a 424 error on the second line of the
code ( If ActiveProject.Name =....) when closing MS Project.

It surprises me that the BeforeSave Event is triggered at this time.

Also, the particular file I use it on does not show up in the visual basic
editor.

Thanks,

James
 
Ad

Advertisements

J

James

Hi Rod,

Thanks for your response.

Using pj.Name works to allow the code I want to run but now I get a
different error when I close MS Project:

Run-time error '91':

Object variable or With block variable not set

I guess the pj variable doesn't return a null if pj is not instiantiated? Is
there some way to handle or throw this error?

Thanks,

James
 
Ad

Advertisements


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