-
I want to open a word document as read only automatically because i know word will ask me that!
How do i do that!
So far:
Set wrd1 = CreateObject("Word.Application")
If txtdoc1.Text = "None" Then
MsgBox "No Word Document To Save"
wrd1.Quit
Else
Set doc1 = wrd1.Documents.Open(txtdoc1.Text)
doc1.SaveAs "C:\testing1"
doc1.Close
wrd1.Quit
End If
-
It is one of argument of the open method of the document object, e.g.:
Code:
Option Explicit
Dim WordApp As Word.Application
Private Sub Command1_Click()
Dim doc As Word.Document
Set WordApp = GetWord()
Set doc = WordApp.Documents.Open("d:\data\personal\bayswater01.doc", , True) 'the True sets it To read only
End Sub
Private Function GetWord() As Word.Application
On Error Resume Next
Set GetWord = GetObject(, "word.application")
If Err.Number <> 0 Then Set GetWord = New Word.Application
GetWord.Visible = True
End Function
-
damn i was doing:
Set doc1 = wrd1.Documents.Open.readonly(txtdoc1.Text)
ta james
-
no probs, intellisense can usually help you out with the extra options allowed for methods. However to get intellisense you need to use early binding like in my example.
-
You'll need to follown JamesM example. Thanks this threed helped a lot!
Jr.