How do I set the Custom Property Tab Template from a VB Macro?

Programming and macros
User avatar
Craig Makarowski
Posts: 52
Joined: Thu Mar 11, 2021 10:59 am
Answers: 0
Location: Edmonton,Alberta,Canada
x 7
x 72

How do I set the Custom Property Tab Template from a VB Macro?

Unread post by Craig Makarowski »

Can't seem to record macro of when you select a Custom Property Template

Image

Now I select the template

Image

then i get this

Image

All the while I'm recording the Macro, even after I click the Apply button and Save!

This is what i get in the Macro

Image

So none of the Property tab template functionallity gets recorded, I need to be able to control this in my Main Macro

that has a form with values that would auto fill the fields in the Property tab. I can fill in the Custom properties directly from

exsisting code but no Idea how to set the Property Tab Template from my VB code.

I'm using SW2013 SP05 x64bit On Win7
User avatar
josh
Posts: 249
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 11
x 19
x 440

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by josh »

sub main()
application.sldworks.activedoc.extension.custompropertybuildertemplate(false) = "whatever.prtprp"
end sub
User avatar
Craig Makarowski
Posts: 52
Joined: Thu Mar 11, 2021 10:59 am
Answers: 0
Location: Edmonton,Alberta,Canada
x 7
x 72

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by Craig Makarowski »

josh wrote: Thu Mar 11, 2021 1:23 pm sub main()
application.sldworks.activedoc.extension.custompropertybuildertemplate(false) = "whatever.prtprp"
end sub
wow that was fast and thank you very much!!! :D :D :D
lenoli
Posts: 2
Joined: Wed Aug 09, 2023 5:27 am
Answers: 0

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by lenoli »

sub main()
application.sldworks.activedoc.extension.custompropertybuildertemplate(false) = "whatever.prtprp"
end sub
this macro can't run in SW2020?
User avatar
gupta9665
Posts: 359
Joined: Thu Mar 11, 2021 10:20 am
Answers: 20
Location: India
x 383
x 414

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by gupta9665 »

lenoli wrote: Wed Aug 09, 2023 5:38 am sub main()
application.sldworks.activedoc.extension.custompropertybuildertemplate(false) = "whatever.prtprp"
end sub
this macro can't run in SW2020?
Did you specified the correct path for the property tab builder file with extension?
Deepak Gupta
SOLIDWORKS Consultant/Blogger
lenoli
Posts: 2
Joined: Wed Aug 09, 2023 5:27 am
Answers: 0

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by lenoli »

gupta9665 wrote: Wed Aug 09, 2023 11:23 am Did you specified the correct path for the property tab builder file with extension?
Yes , I have set system option > file location> CustomPropertyfile folder.
and all CustomProperty template show in list but still not working.
User avatar
gupta9665
Posts: 359
Joined: Thu Mar 11, 2021 10:20 am
Answers: 20
Location: India
x 383
x 414

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by gupta9665 »

lenoli wrote: Thu Aug 10, 2023 1:05 am Yes , I have set system option > file location> CustomPropertyfile folder.
and all CustomProperty template show in list but still not working.
Sorry I meant to ask if you changed the "whatever.prtprp" with your required Custom Property template name with extension?
Deepak Gupta
SOLIDWORKS Consultant/Blogger
T_H2O_mas
Posts: 1
Joined: Mon Aug 28, 2023 4:47 am
Answers: 0

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by T_H2O_mas »

Hi!
After struggling with this particular issue for about half a day, I've discovered that it doesn't like to show whether it succeeded or not.
I tried to use a boolean to show whether it succeeded or not, however that was exactly the thing that prevented it from succeeding.
Just have the line mentioned before, nothing else
User avatar
josh
Posts: 249
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 11
x 19
x 440

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by josh »

You are setting a Property of an object. You don't get a return from setting a Property. You only get returns from Methods.
crimsoncleansed
Posts: 1
Joined: Thu Aug 31, 2023 8:54 am
Answers: 0

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by crimsoncleansed »

Glad I came across the post.

I want to check if it is the desired effect, but when I run this I have to save the file, then close it and reopen it before I can see the Custom Properties template changed out. Is this normal?

Thanks.
little zombie
Posts: 1
Joined: Sun Dec 24, 2023 7:34 pm
Answers: 0

Re: How do I set the Custom Property Tab Template from a VB Macro?

Unread post by little zombie »

This is because the taskpane is not updated in real time. You can switch the taskpane manually or use the following code.

'close taskpane
swApp.SetToolbarVisibility swToolbar_e.swTaskPaneToolbar, False
'open taskpane
swApp.SetToolbarVisibility swToolbar_e.swTaskPaneToolbar, True
Post Reply