Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word is driving me crazy
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01085228
Message ID:
01085318
Vues:
11
Thanks for the try John. When I read the doc, I knew it wasn't quite the same thing, but I tried what it said anyway. No go. The problem is not that I can't run Word because when I run word manually and load the doc manually, it works properly and I can do it a dozen times in a row with no errors. When I do it using automation with the lines below, it runs great on the first attempt, and then crashes every time after that. In order to clean it up, I have to run word manually, load the doc, resave it, and I'm back at square one.

Weirdest thing I've seen in a very long time. Runs great once, but not twice using exactly the same code. I guess I'll have to use the 'send to Microsoft' button and see where that gets me. Say, can I borrow a gun?


>>I have Office XP (office 10) on my system. I started having problems with word automation lately. It's possible the problem has existed since I installed VFP9, but didn't manifest due to my not having run into the situation. Of that, I'm not sure. I've been trying to track down the problem with no luck. I've even reinstalled Office.
>>
>>Whittled down to command window commands:
>>lcDoc is a mail merge document
>>lcData is the data to be merged
>>lcConn is the odbc connection.
>>
>>I should point out that the code has been in the program unchanged for a dogs age.
>>
>>
>>lcDoc = "d:\devel\vfp9\apps\omega32\v3000\temp\lttrj.doc"
>>lcData = "d:\devel\vfp9\apps\omega32\v3000\temp\lttrj.dbf"
>>lcConn = "DSN=OMEGA Visual Foxpro Tables;uid=;pwd=;"+;
>>         "sourcedb=d:\devel\vfp9\apps\omega32\v3000\temp\;sourcetype=dbf;"+;
>>         "exclusive=no;backgroundfetch=yes;collate=machine;"
>>
>>1. oWord = CreateObject("Word.Application")
>>2. oWord.Documents.Open(lcDoc)
>>3. oWord.ActiveDocument.MailMerge.OpenDataSource(lcData,0,0,0,0,0,"","",0,"","",lcConn)
>>4. oWord.Documents.Close(0)
>>5. oWord.Quit()
>>
>>
>>It works as it should with no problems. Now I do exactly the same a second time by using the arrow keys in the command window and just re-running the same lines again. This time, when I try to run statement 2. (oWord.Documents.Open(lcDoc)), I get an error window from MS Word:
>>
>>
Microsoft Word has encountered a problem and needs to close.
>>We are sorry for the inconvenience.
>>
>>There is a lot more to the message in the box, but I'm sure you know the error window I mean. Anyway, for me this is repeatable at will. If I then go directly into word and open the doc, I'll get a message that the last time I opened that doc there was a problem. If I continue, everything is ok. Using Word directly, I can open the doc and the data over and over again with no issues.
>>
>>Anybody have any ideas where I can look to try to figure this out? I've spent a lot more time on this than I was expecting.
>>
>>Thanks
>
>Heres a link that may help - http://support.microsoft.com/default.aspx?scid=kb;en-us;326510
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform