Hi,
I´m trying to make word automation on document custom properties(for a given
property name change the value)
I put this code together:
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; }
and I get this error
Exception Details: 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;
As I understand I dont have the ProgID right
any ideas what should be there
I´m quite new to this and running out of hope
Thanks
I´m trying to make word automation on document custom properties(for a given
property name change the value)
I put this code together:
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; }
and I get this error
Exception Details: 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;
As I understand I dont have the ProgID right
any ideas what should be there
I´m quite new to this and running out of hope
Thanks