Results 1 to 2 of 2

Thread: How can I open a read only word document using vba?
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Sep 2019
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default How can I open a read only word document using vba?

    Hello everyone,
    this is the code I am using to open a word document using excel vba:

    Dim objWord As Object
    Set objWord = CreateObject("Word.Application")
    objWord.Visible = True


    objWord.Documents.Open "C:\Users\dmargraf\Documents\Makro Aufgabe\Testdoc Word.docx"


    I need to open the word file in order to copy its content and paste it into an excel file, but the problem is the word document is "read-only" meaning that an application alert window pops up and stops the makro from working.
    Does anybody know how to work around this problem?

  2. #2
    MrExcel MVP
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    18,880
    Post Thanks / Like
    Mentioned
    38 Post(s)
    Tagged
    5 Thread(s)

    Default Re: How can I open a read only word document using vba?

    Try setting the ReadOnly property to True...

    Code:
    objWord.Documents.Open Filename:="C:\Users\dmargraf\Documents\Makro Aufgabe\Testdoc Word.docx", ReadOnly:=True
    Hope this helps!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •