Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-06-2016, 01:00 PM
rocky2 rocky2 is offline Access Document Property that appears in Panel but cannot find using VBA Windows 10 Access Document Property that appears in Panel but cannot find using VBA Office 2013
Novice
Access Document Property that appears in Panel but cannot find using VBA
 
Join Date: Feb 2016
Posts: 25
rocky2 is on a distinguished road
Default Access Document Property that appears in Panel but cannot find using VBA

Hi,



When I display the document panel I have one property that is called Status. I need to write info there from a macro.

I tried to access it in both ways:
ActiveDocument.CustomDocumentProperties("Status"). Value = .Text
ActiveDocument.BuiltInDocumentProperties("Status") .Value = .Text

But both don't work.
It seems like a Custom Property.
What am I missing?

Thanks,
Rocky
Reply With Quote
  #2  
Old 03-06-2016, 04:24 PM
macropod's Avatar
macropod macropod is online now Access Document Property that appears in Panel but cannot find using VBA Windows 7 64bit Access Document Property that appears in Panel but cannot find using VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Despite being listed, 'Status' is the name of a Custom Document Property that you'd have to add before you can populate it. For that, you can use code like:
Code:
Function SetStatusProperty(wdDoc As Document, StrProp As String, StrTxt As String)
Dim i As Long, bAdd As Boolean
bAdd = True
With wdDoc.CustomDocumentProperties
  For i = 1 To .Count
    If .Item(i).Name = StrProp Then
      .Item(StrProp).Value = StrTxt
      bAdd = False
      Exit For
    End If
  Next
  If bAdd = True Then .Add Name:=StrProp, LinkToContent:=False, Value:=StrTxt, Type:=msoPropertyTypeString
End With
End Function
which you can call with code like:
Code:
Sub Demo()
SetStatusProperty ActiveDocument, "Status", "ABC"
MsgBox ActiveDocument.CustomDocumentProperties("Status").Value
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 03-06-2016, 11:57 PM
rocky2 rocky2 is offline Access Document Property that appears in Panel but cannot find using VBA Windows 10 Access Document Property that appears in Panel but cannot find using VBA Office 2013
Novice
Access Document Property that appears in Panel but cannot find using VBA
 
Join Date: Feb 2016
Posts: 25
rocky2 is on a distinguished road
Default Can there be two properties with the same name?

When I add it - the value changes when I open the document properties window. But in the document panel the value does not change. Which means there are two properties called status?

When I go into the document properties custom window - I do see a property called status, even before I add it in the code, but I can't delete it.

Is there another custom property or built-in property that should be accessed in a different way?
Reply With Quote
  #4  
Old 03-07-2016, 12:21 AM
macropod's Avatar
macropod macropod is online now Access Document Property that appears in Panel but cannot find using VBA Windows 7 64bit Access Document Property that appears in Panel but cannot find using VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I'm not sure what you mean by "in the document panel the value does not change" - it does with the code I posted. And, no, you can't delete 'Status' from the list. Regardless, that's the one the code I posted updates. Update it manually and you'll see the same result.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 03-07-2016, 12:42 AM
rocky2 rocky2 is offline Access Document Property that appears in Panel but cannot find using VBA Windows 10 Access Document Property that appears in Panel but cannot find using VBA Office 2013
Novice
Access Document Property that appears in Panel but cannot find using VBA
 
Join Date: Feb 2016
Posts: 25
rocky2 is on a distinguished road
Default

It does not change in the document panel. I see it above the document and it remains empty.
However, when I go to File->Info and open the Advanced Properties it does have the correct value.

It seems that when I go to File->Properties->Show Document Panel, I see another property called Status.
Where could that come from?
Reply With Quote
  #6  
Old 03-07-2016, 12:50 AM
macropod's Avatar
macropod macropod is online now Access Document Property that appears in Panel but cannot find using VBA Windows 7 64bit Access Document Property that appears in Panel but cannot find using VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The behaviour you're seeing is normal - they're one and the same property.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 03-07-2016, 01:22 AM
rocky2 rocky2 is offline Access Document Property that appears in Panel but cannot find using VBA Windows 10 Access Document Property that appears in Panel but cannot find using VBA Office 2013
Novice
Access Document Property that appears in Panel but cannot find using VBA
 
Join Date: Feb 2016
Posts: 25
rocky2 is on a distinguished road
Default

The problem is that they have different values. In the document panel I have a value of "HelpMe". In the advanced properties I see a value of X29.
I need to change the value in the document panel to be X29.
But it does not change. Only when I manually change it. Not from a macro.

Could there be another property called Status that is defined somewhere else?
It is not in the builtinproperties because I looped through them.
Reply With Quote
  #8  
Old 03-07-2016, 02:19 AM
macropod's Avatar
macropod macropod is online now Access Document Property that appears in Panel but cannot find using VBA Windows 7 64bit Access Document Property that appears in Panel but cannot find using VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

There is a built-in document property named 'Content Status'. Is that what you're referring to?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 03-07-2016, 02:34 AM
rocky2 rocky2 is offline Access Document Property that appears in Panel but cannot find using VBA Windows 10 Access Document Property that appears in Panel but cannot find using VBA Office 2013
Novice
Access Document Property that appears in Panel but cannot find using VBA
 
Join Date: Feb 2016
Posts: 25
rocky2 is on a distinguished road
Default

Yes! You were right!
In the Document Panel the label is Status.
Going manually through the Built in properties by the value I see that the name of the property is Content Status.
Thanks!
Reply With Quote
Reply

Tags
document properties

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Document Property that appears in Panel but cannot find using VBA Userform and Document Information Panel jkimwardtech Word VBA 1 01-21-2016 06:53 PM
Vba code to save document as pdf using document property text and rename folder. staicumihai Word VBA 1 12-21-2015 07:39 AM
Document Property Question ksigcajun Word VBA 9 10-14-2014 11:26 AM
Cannot access most of property of MailItem object on Windows Server 2008 64 bit tz900 Outlook 0 04-10-2012 12:55 PM
Access Document Property that appears in Panel but cannot find using VBA Access to the property of the current table b0x4it Word VBA 2 05-26-2011 06:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft