Solved

Display document properties

Posted on 2009-04-07
13
567 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
  • 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

860 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