Azzera filtri
Azzera filtri

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

75 visualizzazioni (ultimi 30 giorni)
Philipp
Philipp il 12 Lug 2024 alle 13:09
Commentato: dpb il 17 Lug 2024 alle 11:10
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?

Risposte (1)

dpb
dpb il 12 Lug 2024 alle 14:07
Modificato: dpb il 12 Lug 2024 alle 22:55
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 Commenti
Philipp
Philipp il 17 Lug 2024 alle 6:51
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 il 17 Lug 2024 alle 11:10
"...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..

Accedi per commentare.

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by