Detecting and Deleting User Parameters

Johan Ljunggren

Detecting and Deleting User Parameters

Hi,

I have macro that adds User Ref Properties to a document (The ones you see if you click "Define other properties" in the properties window of a part/product document.) These are recognized as User Parameters and be accessed with like this:

Set UserParameter1 = Product1.UserRefProperties

However, I can't seem to be able to remove them. I'm trying these:

UserParameter1 .Remove #

UserParameter1 .Remove ("Name")

I get error "The method Remove failed". The strange thing is that some of the parameter do indeed get removed, but then I will get this error. A closer look reveals that only every other parameter gets removed. My function looks like this:

For i = 1 To UserParameter1 .Count

UserParameter1 .Remove i

Next

I'm guessing the list resets everytime I remove a parameter, so how can I do this any other way?

Douglas Snell

RE: Detecting and Deleting User Parameters
(in response to Johan Ljunggren)

Try reversing your Loop direction:

For i = UserParameter1.Count to 1 Step -1

UserParameter1 .Remove i

Next

--Doug

Johan Ljunggren

RE: Detecting and Deleting User Parameters
(in response to Douglas Snell)

This worked, thank you.