423,311 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,311 IT Pros & Developers. It's quick & easy.

Word Properties Automation

P: n/a
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.GetTypeFromProgID("Word.CustopParoperties");
System.Object obj = Activator.CreateInstance(Prop);
Microsoft.Office.Interop.Word.CustomProperties CustomProp = obj as
Microsoft.Office.Interop.Word.CustomProperties;
foreach (Microsoft.Office.Interop.Word.CustomProperty property in CustomProp)
{ if (property.Name == valfind) property.Value = valreplace; }

So far I´ve been getting the following error

System.ArgumentNullException: Value cannot be null.
Parameter name: type

Source Error:
Line 53:
Line 54: Type Prop =
Type.GetTypeFromProgID("Word.CustopParoperties");
Line 55: System.Object obj = Activator.CreateInstance(Prop);
Line 56:
Line 57: Microsoft.Office.Interop.Word.CustomProperties
CustomProp = obj as Microsoft.Office.Interop.Word.CustomProperties;

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

Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.