Company Property

String property. Returns or sets the value of the Company field in a document's or library's properties.

Applies to: Document object, Library object

Syntax

[[Let] companyRet =] object.Company

object.Company = companySet

The Company property syntax has these parts:

Part Description
object Required. An expression that returns an object from the Applies to list.
companyRet Optional. A String type variable.
companySet Required. An expression that returns a String value.

Remarks

For a new document or library the Company property returns an empty string. Setting the Company property for a document is equivalent to entering information in the Company field in the Document Properties dialog box, tab General (click Document Properties on the File menu). To set Company for a library, use the Properties dialog from the File ->Library menu.

Example

This example contains an application-level script. The program asks the user from a company name, an assigns this name to the Company property of all open documents, which don't have this property set.

' Declare variables
Dim cur_doc As Document
Dim str_company As String

' Ask user to enter company name
str_company = InputBox("Enter company name:")

' If user input nothing, then quit program
If str_company = "" Then
	MsgBox("You did not enter anything!")
	End
End If

' Check all open documents starting from the end of the list
For i=thisApp.DocsNum() To 1 Step -1

	' Get document 
	Set cur_doc = thisApp.Doc(i)
	
	' If no company name is set, set company name provided by user
	If cur_doc.Company = "" Then
		cur_doc.Company = str_company
	End If
	
Next i

 

See Also

Title property, Author property, Subj property, Desc property