close

I am using the following macro in excel to open a specific word document that
the excel file merges records into.

Dim wdApp As Object
Dim wdDoc As Object
Set wdApp = CreateObject(quot;Word.applicationquot;)
Set wdDoc = wdApp.Documents.Open _
(Filename:=quot;B:\test\test.docquot;)

The file loads in word but I get a message stating that the test.doc is read
only. I don't get the error message if I open the test.doc as per normal. How
can I change my macro so the document loads without being read only?

I'd guess that you have a hidden instance of MSWord running.

I'd reboot the pc and try the code one more time.

And I'd add:

wdApp.visible = true

right after the createobject line.

It might make testing easier.

Prohock wrote:
gt;
gt; I am using the following macro in excel to open a specific word document that
gt; the excel file merges records into.
gt;
gt; Dim wdApp As Object
gt; Dim wdDoc As Object
gt; Set wdApp = CreateObject(quot;Word.applicationquot;)
gt; Set wdDoc = wdApp.Documents.Open _
gt; (Filename:=quot;B:\test\test.docquot;)
gt;
gt; The file loads in word but I get a message stating that the test.doc is read
gt; only. I don't get the error message if I open the test.doc as per normal. How
gt; can I change my macro so the document loads without being read only?

--

Dave Peterson

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()