I have a series of tasks to perform, some of which involve working with Word
using the COM interface from C#.NET.

I have one problem I have not solved yet: How to access individual elements
of the BuiltInDocumentProperties in a document.

BuiltInDocumentProperties is defined as an abstract object according to the
COM object browser. But I have not yet found what concrete objects are
derived from this, or how to access them from C#.

From VBA or vbScript it is pretty straight forward:

(vbScript)
docTitle = doc.Builtindocumentproperties (wdTitleField)

Where wdTitleField is a constant defined in the script file. However, in C#
this won't compile.

Any ideas will be most appreciated.

Jason

For example, I need to get the Title field.

Re: Need help accessing BuiltInDocumentProperties from C# by Jonathan

Jonathan
Tue May 10 10:33:58 CDT 2005

Hi Jason,

By opening the VBA editor in Word, you can find the value of the constant
easily enough - press F2 and search for it in the Object browser. I think
you have the wrong constant name - I think yoiu meant to refer to
wdPropertyTitle not wdTitleField. wdPropertyTitle has the value 1.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org


"Jason Reichenbach" <JasonReichenbach@discussions.microsoft.com> wrote in
message news:9E43D878-69A2-4816-BD26-BED7BF1FAEE3@microsoft.com...
>I have a series of tasks to perform, some of which involve working with
>Word
> using the COM interface from C#.NET.
>
> I have one problem I have not solved yet: How to access individual
> elements
> of the BuiltInDocumentProperties in a document.
>
> BuiltInDocumentProperties is defined as an abstract object according to
> the
> COM object browser. But I have not yet found what concrete objects are
> derived from this, or how to access them from C#.
>
> From VBA or vbScript it is pretty straight forward:
>
> (vbScript)
> docTitle = doc.Builtindocumentproperties (wdTitleField)
>
> Where wdTitleField is a constant defined in the script file. However, in
> C#
> this won't compile.
>
> Any ideas will be most appreciated.
>
> Jason
>
> For example, I need to get the Title field.


Re: Need help accessing BuiltInDocumentProperties from C# by JasonReichenbach

JasonReichenbach
Tue May 10 12:34:06 CDT 2005

Hi, Jonathan -

Thank you very much for your reply. My vbscript example was a subset of what
I really have, and is misleading, a bit. What I call wdTitleField is a
constant that is set to the value of wdPropertyTitle...

My apologies for leaving that out.

In any case, I found an excellent article in the Knowledge Base that answers
the question of how to do this in C#.

In case anybody else has this problem, check out

http://support.microsoft.com/?kbid=303296

Thanks again for your reply.


"Jonathan West" wrote:

> Hi Jason,
>
> By opening the VBA editor in Word, you can find the value of the constant
> easily enough - press F2 and search for it in the Object browser. I think
> you have the wrong constant name - I think yoiu meant to refer to
> wdPropertyTitle not wdTitleField. wdPropertyTitle has the value 1.
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
>
> "Jason Reichenbach" <JasonReichenbach@discussions.microsoft.com> wrote in
> message news:9E43D878-69A2-4816-BD26-BED7BF1FAEE3@microsoft.com...
> >I have a series of tasks to perform, some of which involve working with
> >Word
> > using the COM interface from C#.NET.
> >
> > I have one problem I have not solved yet: How to access individual
> > elements
> > of the BuiltInDocumentProperties in a document.
> >
> > BuiltInDocumentProperties is defined as an abstract object according to
> > the
> > COM object browser. But I have not yet found what concrete objects are
> > derived from this, or how to access them from C#.
> >
> > From VBA or vbScript it is pretty straight forward:
> >
> > (vbScript)
> > docTitle = doc.Builtindocumentproperties (wdTitleField)
> >
> > Where wdTitleField is a constant defined in the script file. However, in
> > C#
> > this won't compile.
> >
> > Any ideas will be most appreciated.
> >
> > Jason
> >
> > For example, I need to get the Title field.
>
>