Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ignore word messages
Message
From
08/06/2009 08:42:32
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Ignore word messages
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01404402
Message ID:
01404402
Views:
105
Hi all
I have to search all ms word documents that contain specific text.

[I don't use with window search since Windows search (and vfp filer) doesn't support seraching HEBREW text inside doc.
In addition, I have to control the users access &to manipulate the docs within VFP.]



I have cursor (curwordfiles) with all the *.doc files.
I scan that cursor, openning each document and if the string found (The code following on bottom) and I fill another cursor (curfiles) with this filename.

It's work well (very very slowly, there is no alternative way), but when I scan the documents, Some word doc behave as following:

1. Messagebox 'The file open by other user' ,MS word ask me few options, and after anyway start to open the all following scan document as visible and msword reopen again and again.

2. Ask password.

3. The doc protected and contain form fields - Cannot select\type and search.

Ok
I agree to ignore searching the text in this files (to get it in special list if possible), but vfp doesn't know about any problem (if the files ask password it's not error).

How can I inform vfp to ignore this files without any message?

Tnx

Here is the code:
local odocument, orange, oword,cwordfile,ctexttosearch
oword = createobject("Word.Application")
application.olerequestpendingtimeout = 0&&prevent 'Swith To...' problem(http://support.microsoft.com/kb/240809/en-us)
select curwordfiles
scan
cwordfile=alltrim(curwordfiles.filepath)+alltrim(curwordfiles.filename)
odocument = oword.documents.open(cwordfile)
orange=odocument.content
with orange
if .find.execute(ctexttosearch)
insert into curfiles values (cwordfile)
endif
endwith
endif
endscan
oword.quit(.f.)
Thank you
Chaim
Next
Reply
Map
View

Click here to load this message in the networking platform