API my updates to props are not saved

I have made a VBA routine that can set some custom properties on SW-files.

My routine shows the value of "Title" - then sets Title to a new value.

I would expect the date on the SW-file to change when I made updates - but that does not happen....despite the fact that I can extract the just changed value...

So somehow I don't manage to make the changes "permanent" - when I open the SW-file in SW I am asked to save the changes... and if I reject I am back to the original SW-file.

Do I need to "commit" the changes in order to make the updates permanent?

Reply to
John
Loading thread data ...

I am sure there is a better way, but what I did to remedy this is to save the document after making the changes. If you make the changes at the assembly level it changes the model in memory but doesn't change the one on the Hard Drive. I am sure there is a way to tell the up-level assembly that a component needs to be saved but I haven't looked into it much. Anyway Yes you have to "commit" isn't that what permanent is? =^)

Corey Scheich

Reply to
Corey Scheich

keep in mind the API does exactly the same as the UI (user interface): once you change properties (by hand) you have to save the document. Same with API. And when you have to click the green light for a rebuild, for example to propagate changes made in a part to the assemly, you must call the ModelDoc::Rebuild to do the same... The best way to start a VBA macro is always to record it while doing the job manually...

Reply to
Philippe Guglielmetti

ModelDoc2::SetSaveFlag

Reply to
Sean Phillips

The recorder is not the best way. if people are having problems writing Programs with solidworks API and VBA. Its because they dont know VBA. If you understand VBA. Then everything you need is in the solidworks API help file. learning Solidworks API and VBA at the same time is not the way to do it. Thats how i did it. You need a degree of seperation from what is VBA and what is Solidworks API. After learning VBA the solidworks API is just a tool you use in VBA. I would also say that VBA is a choped up version of VB6. Id learn VB6 and upgrade to .net mabey 1/2 a year from now. I still have not upgraded.

Reply to
Sean Phillips

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.