1

Here is my current code.

Sub PrintMasterTime()

Dim PropVal As Integer
    PropVal = ActiveDocument.CustomDocumentProperties(MasterTime).Value
    Print PropVal

End Sub

Compile Error: Method not valid without suitable object

Not sure why it's not printing. "MasterTime" is the name of my custom document property.

Chrismas007
  • 6,085
  • 4
  • 24
  • 47
Clyde
  • 127
  • 9
  • [`CustomDocumentProperties()` MSDN](http://msdn.microsoft.com/en-us/library/office/aa212718%28v=office.11%29.aspx) and [Returning an object from a collection](http://msdn.microsoft.com/en-us/library/office/aa211950%28v=office.11%29.aspx). I don't think you can call a `.Value` from a collection property. – Chrismas007 Jan 07 '15 at 15:38
  • Can you call a .value from a Regular Document Property and store it as a variable? That would be enough for me. – Clyde Jan 07 '15 at 16:22

1 Answers1

1

You need to call CustomDocumentProperties with a string. You forgot the quotes.

PropVal = ActiveDocument.CustomDocumentProperties("MasterTime").Value
RubberDuck
  • 11,933
  • 4
  • 50
  • 95