VBA Macro Problem - Custom Document Attributes Error

J

James

Hi,

I have written a macro for a customer which until recently was working just
fine. Now the customer is telling me the macro is failing with the following
error:

Run-time error '-2147467259 (80004005)':

Automation error
Unspecified error

I am unable to reproduce the issue, so I asked the customer to open the
Project Global so that it would break at the point in the VBA code which
caused the error. The line of code is:

ActiveProject.CustomDocumentProperties.Add Name:="Phase",
LinkToContent:=False, Type:=msoPropertyTypeString, Value:="Project
Initiation"

In other words, if you go into MS Project and select File > Properties >
Custom, you would see a new field called "Phase" of data type string with
the value "Project Initiation".

Can anyone shed any light on why this issue is occurring?

Regards,

James
 
J

Jan De Messemaeker

Hi,

Just a hunch.
Verify in VBE Tools, References.
Customdocumentproperties is from the office library and if he has changed
Office version recently that reference may be broken.
HTH
 
J

James

Just for everyone's benefit, I found the answer myself. This error occurs if
you try to create/add a custom document property that already exists. You
cannot overwrite the property, you can only delete and recreate it.

James
 

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