필터 지우기
필터 지우기

List all custom properties and add a new one with actxserver Word

조회 수: 6 (최근 30일)
Philipp
Philipp 2024년 7월 12일
댓글: dpb 2024년 7월 17일
Hi all,
I am using actxserver for Word-Documents and manipulating their custom document properties.
I know how to get and set these values as long as the properties are allready implemented.
But, how do I get a list of all custom document properties?
How do I add a new one?

답변 (1개)

dpb
dpb 2024년 7월 12일
편집: dpb 2024년 7월 12일
That is a Word Q?, not MATLAB. See the <Word VBA Reference>. Look at the object model section and find the custom properties object. There's bound to be an Add method. Your task will be to convert the VBA syntax into a form ActiveX commands can execute. The problem is that the VBA compiler is not available to MATLAB so many of the high level features such as named parameters and multiple dot references to a method/property from an object handle aren't available, All parameters must be passed by position and all methods/properties have to be referenced only from the direct parent object. That's the minimum of the modifications that may be needed from VBA example code.
But, if there's a way with VBA, then with perserverence, one can manage to get it to work with ActiveX interface. It may not be trivial, but is possible.
ADDENDUM
  1. One "trick" is to record a macro that does what you want to do and then look at the VBA code generated and translate it as above for ActiveX.
  댓글 수: 6
Philipp
Philipp 2024년 7월 17일
Hi dpb, thank you for all the help and ideas. Sadly, I am not able to program a macro using VBA. From profession, I am a hardware developer and doing matlab stuff, just because thats the only programming language I needed at the moment and it has the easiest access (development environment).
I will research the last recommendation. After that, I will just adapt my word templates as required and ignore the hard coded issues I face.
dpb
dpb 2024년 7월 17일
"...I am not able to program a macro using VBA"
You don't write the code, you just go through the steps and Word records them in the macro for you...then you go look at the auto-generated code to see what the VBA looks like to do what it was you wanted...
See <Create Macro>. To open VBA, you will need to add the "Developer" addin to get the ribbon access, but that is just adding the button to the ribbon if it hasn't been already..

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by