Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Word Properties Automation

Reply
 
Old 04-16-2008   #1 (permalink)
Probi


 
 

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.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


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Modifying OEM properties listed in system properties Vista installation & setup
HP OfficeJet K5400dn freeze when opening print properties in Word Vista print fax & scan
Word Automation on Custom Properties .NET General
Accessing Word document properties PowerShell
Cannot access properties in "local area connection properties" win Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46