I'm trying to export word built-in and custom properties from loads of word documents to access to build a document management system. Any one knows how to create macro in Access? I'm know some Access and basic macro only. Anyone got an example?
One can communicate with word via VBA, not with macro's.
In VBS you should add a reference to word via Tolols/Refrences in the VBA window. When in the refrences window press "M" (for microsift) and move down until you see "Microsoft Word X.X Object Libery" tag this and press OK.
Her is some code that I use to set properties in word but this code will also show you the properties.
WordProp oWord, DLookup("EditorName", "Editor")
Function WordProp(ByVal oWord As Object, Optional Title, Optional Subj, Optional AdrID)
Dim Cat, KeyW
On Error Resume Next
If Not IsBlank(AdrID) Then
Cat = DLookup("CatText", "AddressCategory", "Category=" & AdrID)
KeyW = DLookup("EgenID", "AddressKeywords", "AdrID=" & AdrID)
KeyW = DLookup("Text", "Keywords", "EgenID='" & KeyW & "'")
End If
oWord.Visible = True
oWord.ActiveDocument.BuiltinDocumentProperties(wdPropertyTitle) = Title
oWord.ActiveDocument.BuiltinDocumentProperties(wdPropertyAuthor) = DLookup("EditorName", "Editor")
oWord.ActiveDocument.BuiltinDocumentProperties(wdPropertyCompany) = DLookup("LHead", "Editor")
oWord.ActiveDocument.BuiltinDocumentProperties(wdPropertyHyperlinkBase) = "
Thanks. How do I get to the VBS section? I don't see Tools->References. You mentioned "In VBS you should add a reference to word via Tolols/Refrences in the VBA window
Hi "VBS" is a typo... sry, should read "VBA"
Use "Alt+F11" to get to the VBA window.
VBA stands for Visual Basic for Applications and is a close to VB (Visual Basic) programming language, used throughout the office package and other programs from M$
To create a module goto Insert, choose Module in the menu bar. You are now ready to start programming.
Once you are in the VBA-window and your code is running you you can tab thru the code using the keys F8 and F5.
I can see that I incl. a small function in my code "IsBlank" this checks for IsNull/IsEmpty/etc. all on one go. this is the function:
Function IsBlank(V As Variant) As Boolean
On Error Resume Next
V = "" & V
If Len(V) = 0 Then IsBlank = True
End Function
Drop this into your new module, save your module and give it a meaningfull name.
I am sounding really dumb but....I got only as far as the object library. For some reason WordProp Word isn't recognised. The Microsoft Word object is 9.0.
Does this vba help in importing Microsoft Word document properties (builtin and custom) to Microsoft Access from a specific filepath and folder? And what is the vba then for exporting fields into the document properties?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.