![]() |
Word Doc locked for ediiting
Hello
I am trying to open a WORD document from within an EXCEL macro, which I manage to do successfully, however, sometimes it prompts me the following message File "destination.doc" is locked for editing by Michael Do you want to (a) Open a Read only Copy (b) Create a local copy and merge your changes later (c) Receive notification when the original is available When this message appears (which seems to be intermitantly) I would like hte excel macro to automatically select option a. How do I do this? I am opening the doc with the following line in the excel macro Set wordApp = CreateObject("Word.Application") wordApp.Documents.Open ("c:\Temp\destination.doc") |
Word Doc locked for ediiting
My bet is that while you were testing, you opened the document in a hidden
instance of MSWord. You could use this to see if the file is open before you start: http://support.microsoft.com?kbid=138621 Microsoft's IsFileOpen function. Depending on what version of Windows you're using, you might be able to kill that hidden instance of MSWord. Alt-ctrl-delete task manager (maybe) processes (look for winword.exe) I used a .vbs script when I was testing your other post: dim myWord On Error Resume Next Set myWord = GetObject(, "Word.Application") If Err.Number = 429 Then msgbox "Word is not running" else myWord.visible = true end If On Error GoTo 0 Set myWord = nothing === Just copy into notepad and save it as Unhide.vbs Then you can double click (in windows explorer) to unhide any instances (and there could be several). Unhide, close, unhide, close, etc until you run out of them. kaiser wrote: Hello I am trying to open a WORD document from within an EXCEL macro, which I manage to do successfully, however, sometimes it prompts me the following message File "destination.doc" is locked for editing by Michael Do you want to (a) Open a Read only Copy (b) Create a local copy and merge your changes later (c) Receive notification when the original is available When this message appears (which seems to be intermitantly) I would like hte excel macro to automatically select option a. How do I do this? I am opening the doc with the following line in the excel macro Set wordApp = CreateObject("Word.Application") wordApp.Documents.Open ("c:\Temp\destination.doc") -- Dave Peterson |
All times are GMT +1. The time now is 04:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com