Compile error: User-defined type not defined - Microsoft.Office.Core.DocumentProperties RRS feed

  • Question

  • Hi all,

    I keep on getting this error no matter what I do:  User-defined type not defined

    I have already been through most of the internet for answers. I have watched YouTube clips and God knows what, but there's nothing that seems to help, and yes! I've looked at Microsoft homepage as well :-)

    I also think that I have the right referens (see above), it's at least the one recommended in most comments I've found. Right now I'm in a tight spot and need to deliver soon. Not only is it ages since I used VB but to have this problem as well,,,,it's almost to much..

    So please help me, anything is appreciated.

    My task is to fill out some cells with information from the File Properties, that's about it. Is there any other way around this, other that what I try to do feel free to help me out.. 



    Thursday, April 21, 2016 12:02 PM

All replies

  • This forum is for VBA.  It sounds like you are using VSTO.  Is this Word or Excel?  Don't know if this helps but if this is Word you can create and retrieve custom properties in VBA like this:

    Sub test()
      Dim doc As Document
      Dim prop As String
       Set doc = ActiveDocument
       doc.CustomDocumentProperties.Add Name:="MyCustomProp", LinkToContent:=False, Value:="MyValue", Type:=msoPropertyTypeString
       prop = doc.CustomDocumentProperties("MyCustomProp")
    End Sub

    • Edited by mogulman52 Thursday, April 21, 2016 3:12 PM
    Thursday, April 21, 2016 3:10 PM