HOWTO: Use OLE Automation to Get File Summary from Word 6 DocID: Q122239
|
Visual Basic can communicate with Word version 6.0 through OLE Automation. For example, by using OLE Automation, you can access a Word document's file
summary information from a Visual Basic application.
NOTE: The CurValues method discussed in the More Information section can be used with any Word dialog box such as ToolsOptionsView, DocumentStatistics,and so on.
The following steps show you how to create a Visual Basic application that
retrieves file summary information from a Word version 6.0 document:
Sub Command1_Click ()
Dim TestWord As object
Dim Wordvalues As object
Set TestWord = CreateObject("word.basic")
' In the next command, replace C:\GENERIC.DOC with the name
' of the Word version 6.0 document for which you want to view the
' summary information.
TestWord.fileopen ("C:\GENERIC.DOC")
Set Wordvalues = TestWord.curvalues.FileSummaryInfo
title$ = Wordvalues.title
MsgBox "Title: " & title$
subject$ = Wordvalues.subject
MsgBox "Subject: " & subject$
author$ = Wordvalues.author
MsgBox "Author: " & author$
filename$ = Wordvalues.filename
MsgBox "FileName: " & filename$
directory$ = Wordvalues.directory
MsgBox "Directory: " & directory$
Set Wordvalues = Nothing
Set TestWord = Nothing
End Sub
Additional query words:
Keywords : kbinterop kbAutomation kbVBp300
Version : WINDOWS:3.0,6.0
Platform : WINDOWS
Issue type :
Last Reviewed: July 26, 1999