I need to get, from macro, document keywords and comments properties. I wrote a simple macro but it doesn’t work (see attached file ).
Thank you in advance.
Maurizio
Install and use the object inspection tool named XrayTool.
https://berma.pagesperso-orange.fr/index2.html
Then you will able to list the properties odf the programming objects:
xray theProps
You will se, that the Keywords variable is an Array. You must get its elements.
Hewre is the modified code:
REM ***** BASIC *****
Function docInfo(pChoice As String)
theDoc = ThisComponent
theProps = theDoc.DocumentProperties
xray theProps
Select Case pChoice
Case "Author"
docInfo = theProps.Author
Case "Title"
docInfo = theDoc.Title
Case "Keywords"
theKeywordsArray = theProps.Keywords
docInfo = theKeywordsArray(0)
Case else
End Select
End Function
Sub PrintInfo
MsgBox(DocInfo("Keywords"),0,"Title of the MsgBox")
End Sub
Try it.
thank you very much!