473,405 Members | 2,379 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,405 software developers and data experts.

read/write word document properties from Access

I create an application with Access 2000 and I wish to read/write the properties of a specified word document. I use dsofile.dll
my code is
Expand|Select|Wrap|Line Numbers
  1. Function fGetDocProps(strInFile As String, strProp As String) 
  2. Dim objWord As Object, objDocProps As Object 
  3.  
  4.  
  5.     On Error GoTo Err_fGetDocProps 
  6.     Set objWord = CreateObject("Word.Application") 
  7.     objWord.Documents.Open strInFile 
  8.     Set objDocProps = objWord.ActiveDocument.BuiltInDocumentProperties 
  9.     fGetDocProps = objDocProps(strProp) 
  10.  
  11. Exit_fGetDocProps: 
  12.     objWord.Application.Quit savechanges:=False 
  13.     Set objDocProps = Nothing 
  14.     Set objWord = Nothing 
  15.     Exit Function 
  16.  
  17. Err_fGetDocProps: 
  18.     fGetDocProps = "Error: Probably File/Property does not exist." 
  19.     Resume Exit_fGetDocProps 
  20. End Function 
  21.  
  22. Function fEnumProps(strInFile As String) 
  23. Dim objWord As Object, objDocProps As Object 
  24. Dim i As Integer 
  25.     On Error Resume Next 
  26.     Set objWord = CreateObject("Word.Application") 
  27.     With objWord 
  28.         .Documents.Open strInFile 
  29.         Set objDocProps = 
  30. objWord.ActiveDocument.BuiltInDocumentProperties 
  31.         For i = 0 To objDocProps.Count - 1 
  32.             Debug.Print objDocProps(i).Name, objDocProps(i).Value 
  33.         Next i 
  34.     End With 
  35.     objWord.Application.Quit savechanges:=False 
  36.     Set objWord = Nothing 
  37. End Function 
  38. ***************************************************** 
  39.  
if I want to read a property (for example "title") I write

msgbox (fGetDocProps("C:\test\sample.doc","Title"))

but I don't understand how to write and change that property
thanks
Maurizio
Oct 13 '07 #1
3 5919
nico5038
3,080 Expert 2GB
The general way to assign a value to properties is to use:
Object.propertyname = "value"
or
Object.Properties("propertyname") = "value"

However not all properties can be written, some are "read-only".....

Nic;o)
Oct 13 '07 #2
NeoPa
32,556 Expert Mod 16PB
I'm afraid that, although you're using Access as a coding base, this question is really about a separate library (DLL). I will happily leave it here but there may not be many of our Access experts who know much about this library for accessing the properties of an MS Word via the file-system. Have you tried using Google to search for items on that library? Or even the procedure call you used to read the property?
Oct 13 '07 #3
NeoPa
32,556 Expert Mod 16PB
I did a quick Google for you and found the following Microsoft KnowledgeBase article which should help you do exactly what you want (The Dsofile.dll files lets you edit Office document properties when you do not have Office installed).
Good luck.
Oct 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

41
by: Ruby Tuesday | last post by:
Hi, I was wondering if expert can give me some lite to convert my word table into access database. Note: within each cell of my word table(s), some has multi-line data in it. In addition, there...
2
by: kelly.pearson | last post by:
I had some access 97 reports that I used to publish to MS Word that worked before we upgraded to Access 2K and Word 2K. Although there were some minor discrepancies, I was able to tweak the access...
4
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
3
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
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...
5
by: Jeffrey Bradshaw | last post by:
Hey everybody, I've got a VB.NET program that is trying to access a Word document and I'm having all kinds of trouble. First on is the above. I'm trying to get the number of lines in the document...
8
by: Tim Murphy | last post by:
How do you read/write a Word document embedded in an OLE Object field in an Access table with VB.NET? I have an Access application where users are creating and editing Word documents that are...
3
by: Charles Law | last post by:
Word has a property BuiltinDocumentProperties, which (in VBA) returns a DocumentProperties collection. In VB.NET, using Word automation, it returns a _ComObject. I have tried to cast this to...
2
by: a.crowley | last post by:
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.