Results 1 to 5 of 5

Thread: ReadOnly help!!!!

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    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

  2. #2
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Sydney Australia
    Posts
    804
    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

  3. #3

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    damn i was doing:

    Set doc1 = wrd1.Documents.Open.readonly(txtdoc1.Text)

    ta james

  4. #4
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Sydney Australia
    Posts
    804
    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.

  5. #5
    Junior Member
    Join Date
    Jul 2000
    Posts
    16

    Talking

    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
  •  



Click Here to Expand Forum to Full Width