Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Word Document Read Only From Access Form

Status
Not open for further replies.

xeb

Technical User
Nov 14, 2003
81
US
Hi:

From Access I'm opening a Word document with the following code. I want it to be Read Only without any message boxes, password boxes, etc. for the user. Just open as Read Only. Can this be done?

Thanks,

xeb



Private Sub Command1_Click()

Dim LWordDoc As String
Dim oApp As Object

'Path to the word document
LWordDoc = "c:\Doc1.doc"

If Dir(LWordDoc) = "" Then
MsgBox "Document not found."

Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True

'Open the Document
oApp.Documents.Open filename:=LWordDoc
End If

End Sub
 
Hi xeb

I think all that you need to do is to change the following line :-

'Open the Document
oApp.Documents.Open filename:=LWordDoc, ReadOnly:=True

You will not be able to overwrite the original but you can save the document under a different name.

Hope this helps

#
###
#####
#######
Ziggurat
 
That works great! Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top