Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open Word file with Excel VBA
Hi,
I want to open a Word file using an Excel macro, but it doesn't work as I want. I get the message: This file is locked for editing by another user....." It must have something to do with the macro, because the file is not locked or already open. How can I avoid this message? Dim wdApp As Object Dim wdDoc As Object Set wdApp = CreateObject("Word.application") wdApp.Visible = True Set wdDoc = wdApp.Documents.Open _ (Filename:="C:\Documents and Settings\XXX\Desktop\test.doc") Regards Kaj Pedersen |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open Word file with Excel VBA
The code worked for me.I think you have opened the file
programmatically earlier and not closed.It will not be visible. Try to close the file containg macro .reopen the file and try once. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open Word file with Excel VBA
In message
s.com of Sun, 25 Sep 2011 22:50:12 in microsoft.public.excel.programmin g, Javed writes The code worked for me.I think you have opened the file programmatically earlier and not closed.It will not be visible. Try to close the file containg macro .reopen the file and try once. I roughly agree. The OP might reboot the system to start with a known position and see if the problem disappears. There seems to be a lack of facilities in Office to tidy up automatically after Office opens another application. One can easily get orphan applications which are hidden. e.g. With code (untested) like: CreateObject("Word.application").Documents.Open(Fi lename:=foo) I expect there is a hidden instance of Word locking "C:\Documents and Settings\XXX\Desktop\test.doc". On my Vista system running Office 2003, I would open the Task Manager, after right-clicking on an empty part of the Taskbar, and looking for WINWORD.EXE in the processes tab. "End Process" with confirmation should zap the problem. The OP does not say which version of Office or operating system shows the problem. -- Walter Briscoe |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Open new Word file via Excel | Excel Programming | |||
open word from excel...file does not exist error | Excel Programming | |||
Using an Excel macro to open a Word File | Excel Programming | |||
Open One Word File from Excel | Excel Programming | |||
Graph Excel Selection, Open Word File, Embed Graph Into Word | Excel Programming |