JimmyTheHand
04-05-2017, 08:35 AM
Hi,
I've not posted here for several years, but I still remember the best experts are here on this forum. So here's my problem.
I'm working on a program that processes all docx documents in a folder. I'm opening the documents one by one.
Set WA = CreateObject("Word.Application")
WA.Visible = True
Set WD = WA.Documents.Open(FileName:=DocPath, ConfirmConversions:=False, ReadOnly:=True, NoEncodingDialog:=True)
However, some of the documents are password protected. And here my program stops working, waiting for user interaction. I would like to automatically abort the document opening, if, for example, it's not successful for 10 seconds (e.g. proper password was not supplied). I was trying to set up a form timer, with interval of 10000, that would quit then recreate the word application:
Private Sub Form_Timer()
WA.Quit
Set WA = CreateObject("Word.Application")
WA.Visible = True
End Sub
But it never gets executed while the Word Application waits for the password.
I thought maybe I could set the Word app/window to be non-modal, but I found nothing that made this possible.
Any ideas how to crack this nut?
Jimmy
I've not posted here for several years, but I still remember the best experts are here on this forum. So here's my problem.
I'm working on a program that processes all docx documents in a folder. I'm opening the documents one by one.
Set WA = CreateObject("Word.Application")
WA.Visible = True
Set WD = WA.Documents.Open(FileName:=DocPath, ConfirmConversions:=False, ReadOnly:=True, NoEncodingDialog:=True)
However, some of the documents are password protected. And here my program stops working, waiting for user interaction. I would like to automatically abort the document opening, if, for example, it's not successful for 10 seconds (e.g. proper password was not supplied). I was trying to set up a form timer, with interval of 10000, that would quit then recreate the word application:
Private Sub Form_Timer()
WA.Quit
Set WA = CreateObject("Word.Application")
WA.Visible = True
End Sub
But it never gets executed while the Word Application waits for the password.
I thought maybe I could set the Word app/window to be non-modal, but I found nothing that made this possible.
Any ideas how to crack this nut?
Jimmy