gammbro
asked on
Accessing Word Document Properties
I have a form that opens Word documents within a web browswer control.
Having a reference to the Word Object Library, I can open the Properties dialog by using:
"mDoc.Application.Dialogs( wdDialogFi leSummaryI nfo).Show"
My question is can the data in this dialog be accessed via vb code so that I can update it with data from an Access db, without the user seeing it?
Having a reference to the Word Object Library, I can open the Properties dialog by using:
"mDoc.Application.Dialogs(
My question is can the data in this dialog be accessed via vb code so that I can update it with data from an Access db, without the user seeing it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, you cannot access the 'document' properties without a document.
So you still need to open it. If you don't want to show it, just set the oWord.Visible property to false.
D'Mzzl!
RoverM
So you still need to open it. If you don't want to show it, just set the oWord.Visible property to false.
D'Mzzl!
RoverM
ASKER
When I try to run, I get an error on the GetObject function:
Runtime Error '432'
File name or class name not found during Automation operation.
The file exists and I have the correct path specified to the file.
Runtime Error '432'
File name or class name not found during Automation operation.
The file exists and I have the correct path specified to the file.
gammbro:
Where do you get the error (trace through the code ?) ?
Where do you get the error (trace through the code ?) ?
ASKER
Actually, I got it to work. I was intializing my variable incorrectly.
However, I have another question related to this. I am looking to secure my Word documents by placing a password on them.
How can I go about this through vb code?
However, I have another question related to this. I am looking to secure my Word documents by placing a password on them.
How can I go about this through vb code?
This example will allow you to set a password:
With oWord.ActiveDocument
.ReadOnlyRecommended = False
.Password = "myopenpassword"
.WritePassword = "myeditpassword"
End With
To remove the password from the document, just set the password to an empty string : "".
After changing it:
oWord.ActiveDocument.Saved = False
oWord.ActiveDocument.Save
You have to do this because else Word 'thinks' that nothing did change, and will NOT update the password.
D'Mzzl!
RoverM
With oWord.ActiveDocument
.ReadOnlyRecommended = False
.Password = "myopenpassword"
.WritePassword = "myeditpassword"
End With
To remove the password from the document, just set the password to an empty string : "".
After changing it:
oWord.ActiveDocument.Saved
oWord.ActiveDocument.Save
You have to do this because else Word 'thinks' that nothing did change, and will NOT update the password.
D'Mzzl!
RoverM
Hi gammbro@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Accept roverm's comment(s) as an answer.
gammbro@devx, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Accept roverm's comment(s) as an answer.
gammbro@devx, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Per recommendation, force-accepted.
Netminder
CS Moderator
Netminder
CS Moderator
ASKER
Now, can I refer to the Word Properties dialog box without opening the document in by broswer control, or does the document have to be open?