Word Properties Automation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UHJvYmk=?=

    Word Properties Automation

    I´m trying to do some Word Automation in C# in the Custom Properties
    so far found very few ways to do that

    I made the following :
    Type Prop = Type.GetTypeFro mProgID("Word.C ustopParopertie s");
    System.Object obj = Activator.Creat eInstance(Prop) ;


    Microsoft.Offic e.Interop.Word. CustomPropertie s CustomProp = obj as
    Microsoft.Offic e.Interop.Word. CustomPropertie s;
    foreach (Microsoft.Offi ce.Interop.Word .CustomProperty property in CustomProp)
    { if (property.Name == valfind) property.Value = valreplace; }

    So far I´ve been getting the following error

    System.Argument NullException: Value cannot be null.
    Parameter name: type

    Source Error:


    Line 53:
    Line 54: Type Prop =
    Type.GetTypeFro mProgID("Word.C ustopParopertie s");
    Line 55: System.Object obj = Activator.Creat eInstance(Prop) ;
    Line 56:
    Line 57: Microsoft.Offic e.Interop.Word. CustomPropertie s
    CustomProp = obj as Microsoft.Offic e.Interop.Word. CustomPropertie s;

    I understand I dont have the ProgID right but have no idea how to do this,
    I´m quite new in C# and all
    Even dont know if this is the best place for my question

    Any help I´ll be thankful

Working...