|
-
Apr 19th, 2001, 01:40 AM
#1
Thread Starter
PowerPoster
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
-
Apr 19th, 2001, 01:50 AM
#2
Fanatic Member
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
-
Apr 19th, 2001, 02:06 AM
#3
Thread Starter
PowerPoster
damn i was doing:
Set doc1 = wrd1.Documents.Open.readonly(txtdoc1.Text)
ta james
-
Apr 19th, 2001, 02:11 AM
#4
Fanatic Member
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.
-
Aug 31st, 2001, 05:39 PM
#5
Junior Member
You'll need to follown JamesM example. Thanks this threed helped a lot!
Jr.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|