Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-31-2014, 11:12 AM
Ted C Ted C is offline Automate document properties Windows XP Automate document properties Office 2007
Novice
Automate document properties
 
Join Date: Oct 2011
Posts: 18
Ted C is on a distinguished road
Default Automate document properties

I would like to automatically set certain document properties in a Word document when the user saves the file. I can send text to the properties, but I am having trouble retrieving the values I want to use from the document content.



The second page of the document is a table of document information, such as title, subject, and author. I want to use this table as the source for the document properties.

Here is my code.

Code:
Sub SetProperties()
'
' Set key document properties
'
     Set docInfoTable = ThisDocument.Tables(1)
    Set docTitleCell = docInfoTable.Cell(Row:=2, Column:=2)
    Set docSubjectCell = docInfoTable.Cell(Row:=4, Column:=2)
    Set docAuthorCell = docInfoTable.Cell(Row:=9, Column:=2)
    Set docManagerCell = docInfoTable.Cell(Row:=10, Column:=2)
  
    ThisDocument.BuiltInDocumentProperties("title") = docTitleCell.Text
    ThisDocument.BuiltInDocumentProperties("subject") = docSubjectCell.Text
    ThisDocument.BuiltInDocumentProperties("author") = docAuthorCell.Text
    ThisDocument.BuiltInDocumentProperties("manager") = docManagerCell.Text
    ThisDocument.BuiltInDocumentProperties("category") = "Generic Template"
    
'
' Save the document
'
    ActiveDocument.Save
'
' This macro replaces FileSave on the CTRL+s keyboard shortcut
'
    
End Sub
I currently get "Run-time error '438': Object doesn't support this property or method" at the highlighted line.

If "Text" is not the property for the text contained in a table cell, what is?
Reply With Quote
 

Tags
properties



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate document properties Help with Document Properties Prompt Macro KJJ Word VBA 14 11-10-2016 08:18 PM
Automate document properties Updating Document Properties without using advanced properties dialogue thedr9wningman Word VBA 3 01-20-2014 05:56 PM
Key shortcut to access document properties eroock Word 0 12-11-2012 10:54 AM
Automate document properties Add custom document properties into document NicBodkin Word 8 05-05-2011 09:09 AM
document properties issues charris1980 Word 0 04-29-2009 12:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:56 AM.


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