473,395 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Import file properties from MS Word to Access

I have a large set of Word documents that I wish to catalogue in an
Access database. Each document has a set of file properties populated
(title, subject, author, keywords, comments ect), so I'd like to import
those into an Access table for processing. I've written VBS macros in
the past to import data from Excel sheets into Access tables, but the
same functionality does not appear to be available for Word. Any clues
or sample code appreciated.

Thanks

Apr 21 '06 #1
2 4054
a.*******@steel-sci.com wrote:
I have a large set of Word documents that I wish to catalogue in an
Access database. Each document has a set of file properties populated
(title, subject, author, keywords, comments ect), so I'd like to import
those into an Access table for processing. I've written VBS macros in
the past to import data from Excel sheets into Access tables, but the
same functionality does not appear to be available for Word. Any clues
or sample code appreciated.


Perhaps one way is to use Automation (VBA Tools > References - Check the
Microsoft Word X Object Library [X = your version of Word]) to get the
Document.CustomDocumentProperties or the Document.BuiltInDocumentProperties.

There's probably an API that can scan folder contents for the same info
(in Windows XP if the cursor hovers over a Word file in Windows Explorer
the BuiltIn properties information appears).
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Apr 21 '06 #2
Thanks for that. However, I ended up doing it the other way around.
That is, using Word to export the file properties to Access. Sample
code below:

Sub GetDataToDataBase()

' The following is the code that you would use to transfer the file
properities from Word into an Access database:

'Define variables

Dim vConnection As New ADODB.Connection
Dim vRecordSet As New ADODB.Recordset

'provide connection string for data using Jet Provider for Access
database
vConnection.ConnectionString = "data source=mydatabase.mdb;
Provider=Microsoft.Jet.OLEDB.4.0;"

'Open a new version of the temporary RecordSet accessing the table in
Database
vRecordSet.Open "MyTable", vConnection, adOpenKeyset,
adLockOptimistic

'we can't enter "nothing", so only set variables with some data entered
info the Field
If ActiveDocument.BuiltInDocumentProperties("Title") <> "" Then
vRecordSet!Title =
ActiveDocument.BuiltInDocumentProperties("Title")
End If

' repeat for "Subject", "Keywords", "Comments", "Creation Date",
"Last Save Time", "Category",
' "Author""Manager", "Company" as desired
'update the RecordSet to the database, this adds the information to the
table in the database.
vRecordSet.Update
'close the recordset
vRecordSet.Close
'close objects
vConnection.Close
'clear object to free up memory
Set vRecordSet = Nothing
Set vConnection = Nothing

End Sub

Apr 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DCM Fan | last post by:
Access 2K, SP3 on Windows 2K, SP4 All, I have an import spec set up with quoted Identifiers and comma-separated values. The text file is produced by a 3rd-party program of which I have no...
4
by: Craig | last post by:
I'm trying to build a filter for a file search where the search will be able to filter out certain files according to certain "file properties", like Owner, Creation Date, etc. MS does this in...
6
by: Tom C. | last post by:
Hi I'm trying to create a web form that will print a MS Word doc from the web form. I'm using VB.net. This is the code example Dim WordApp As New Word.Applicati Private Sub...
18
by: PW | last post by:
Convert them to CSV in Excel, then use TransferText (which does not work correctly and also doesn't accept XLS/Excel files directly) or create a link to an Excel XLS workbook and do an Append Query...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.