473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

Jun 27 '08 #1
0 909

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Emily John | last post by:
I have a word document that I need to send it as an attachment to an XML file. Basically, converting into byte array or using some encoding mechanism. This has to be done through XML serialization...
12
by: Cheval | last post by:
Has anyone had any problems with inter-office automation between MS Word and MS Access in Office 2003? I have recently installed office 2003 in a new folder and have left the older office 2000...
4
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to...
12
by: Evan Stone | last post by:
If one is developing a .NET application, how can I develop an application that uses COM automation that targets multiple versions of Word? For example, the signature for the Document.Open method is...
4
by: Bill Coan | last post by:
NOTE: This was posted earlier to vsnet.vstools.office under a different subject line but received no response. I'm having a problem automating Word's Find object from a .NET application, using...
3
by: Charles Law | last post by:
Word has a property BuiltinDocumentProperties, which (in VBA) returns a DocumentProperties collection. In VB.NET, using Word automation, it returns a _ComObject. I have tried to cast this to...
2
by: a.crowley | last post by:
I have a large set of Word documents that I wish to catalogue in an Access database. Each document has a set of file properties populated (title, subject, author, keywords, comments ect), so I'd...
0
by: Probi | last post by:
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 =...
0
by: Tim Rowe | last post by:
2008/10/7 Peter Wang <peterwang@vip.qq.com>: Why use VBA? It's actually not a straight choice. VBA is pretty much all that's available if you're doing it from *inside* Word, it's not available...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.