Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Display document properties

Posted on 2009-04-07
13
Medium Priority
?
572 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1500 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
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.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 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