Solved

Display document properties

Posted on 2009-04-07
13
570 Views
Last Modified: 2013-12-26
I am trying to display a property (Category property) of a word document in a message box using this code -
MsgBox (ActiveDocument.BuiltInDocumentProperties(Category).Value)

Geting an invalid call procedure error
Any suggestions?
0
Comment
Question by:sbsbats
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 3

Expert Comment

by:OutOfTouch
ID: 24093749
What version of VB or flavor of VB are you using?
This might help:
http://www.vb-helper.com/howto_show_word_builtin_properties.html
 
0
 

Author Comment

by:sbsbats
ID: 24093783
VB 6.5
Shouldn't ActiveDocument.BuiltInDocumentProperties(Category).Value - return the property value?

The code above dosn't help me - I am writing the properties to the document already through a form and was just wondering why this syntax is incorrect
0
 
LVL 3

Expert Comment

by:OutOfTouch
ID: 24093811
Do you mean that your using VB 6.0?
I forgot to ask you what version of MS Word you are using and what the error message is.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

Author Comment

by:sbsbats
ID: 24093849
HI,

Nope its 6.5 (Help - about)
Office 2003
error message = Invalid call procedure
0
 
LVL 3

Expert Comment

by:OutOfTouch
ID: 24093882
That is VB 6.0 with service pack 5 installed.
0
 

Author Comment

by:sbsbats
ID: 24093904
Thats great we now agree on the version
0
 
LVL 3

Expert Comment

by:OutOfTouch
ID: 24094010
Unfortunately I don't have VB 6.0 on my dev box anymore, so I can't garauantee that this will work.
Try this wdPropertyCategory where you have category in your code above.
0
 

Author Comment

by:sbsbats
ID: 24094086
Cheers for that mate but still no go - get the same error message - invalid call to a procedure ...."
0
 
LVL 3

Accepted Solution

by:
OutOfTouch earned 500 total points
ID: 24094124
You could try this to see if the category is property is there:
 For Each prop In doc.BuiltInDocumentProperties
        On Error Resume Next
        WriteLine " " & prop.Name & " = " & prop.Value
Next
 
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 24095834
should it be

MsgBox (ActiveDocument.BuiltInDocumentProperties("Category").Value)
0
 
LVL 3

Expert Comment

by:OutOfTouch
ID: 24099525
lol, I didn't realize he didn't have quotes in is code. I should have been paying closer attention, doh. Sorry.
0
 

Author Comment

by:sbsbats
ID: 24101427
sorry guys the above is a typo - I do have the quotes but still no go
0
 

Author Comment

by:sbsbats
ID: 24101472
HI,

Thanks for all the help - I was using the custom properties (CustomDocumentProperties) procedure for existing properties and the above (built in properties) to access custom properties - silly
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question