Date change macro

Date anyone have a macro that will change the date custom property for all parts in an assembly?

I love doing pack and go to copy an assembly and renumber it, but all the date custom properties need to get updated to the current date. I was hoping someone else has a macro that would update them all.

https://forum.cadmunity.com/t/macro-to-change-custom-properties/2274/1

I use that one all the time and it works great, the difference is I just want to enter the date, say 03/07/2024 and it changes all of them to that date.

The issue I have is sometimes the dates are not all the same if I did different parts on different days, so entering the value I want to change doesn’t work. I would like it to just change every date custom property in each part to the date entered in the box.

Can you share one sample file to understand?

Every part and sub-assembly in an assembly has a “Date” custom property. When I do a pack & Go to make a new version they do not update, and they can be different vales (ie. The screenshot below has 11/17/2023 as the date on one part, but the other part has 12/01/2023). I want the macro to change all the date custom properties on each part and sub assembly in the assembly to change to the date I input in the macro.

This part M-247-A has a date of 11/17/2023
image.png
This part M-247-A-B1 has a date of 12/01/2023
image.png
After I did the pack & go and created these parts as part of the new assembly I got to go in and change the date on each one, some assembly’s have 30 or 40 parts where I have to open each one and change the date to 03/08/2024.

The macro I have shared above should work OK.

Did you changed the number in below line to Date?

cpm.Add3 “Number”, swCustomInfoText, mValue, 1