Sandy Devers
Sandy Devers

Reputation: 11

DocumentProperty.Name in Office 16.27 for Mac generates Invalid procedure call or argument

I'm trying to read Office document properties with VBA.

I get an error with DocumentProperty.Name with Office for Mac. This appears to be a change in version 16.27 (or so).

The code works on Windows.

On Mac the same error occurs for Word, Excel and PowerPoint (taking into account the ActiveDocument/Workbook/Presentation difference).

Sub ListDocProps()

 Dim prop As DocumentProperty
 Dim msg As String

 For Each prop In ActiveDocument.BuiltInDocumentProperties
  msg = msg & prop.Name

  On Error Resume Next
   msg = msg & prop.Value
 Next

 MsgBox msg, vbOKOnly
End Sub

I was expecting to see the property names, but I get the error message:

Invalid procedure call or argument

Upvotes: 1

Views: 73

Answers (1)

Sandy Devers
Sandy Devers

Reputation: 11

I suspect that Microsoft thinks this was a bug. In a more recent build of Office, Version 16.29 (19081902), the problem has disappeared.

Thanks for reading, Sandy

Upvotes: 0

Related Questions