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:
01085330
Vues:
18
>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?
>
>

Sorry, I don't loan guns to anyone but family!<g>

Have you tried shutting everything else down? (Outlook runs another Word session).

Have you tried setting safety off, or is it reporting the error from Word also?

I seem to recall running into something like this, and it may have been because of an orphaned instance of Word. Try running George Tasker's is_run32 to see if there is another instance of Word running.

Here is his code if you don't have it:
* FUNCTION: Is_Run32.prg
* AUTHOR: George Tasker
* DATE: January 13, 1998 - 8:26 AM
* PURPOSE: Determines if a Windows
* application is running and returns
* the handle of the window if it is,
* otherwise returns 0. 32 bit version
* for Windows 95/NT 3.51-4

LPARAMETER pctitle

* Parameter list description
*
* pctitle - The title bar of the Window
*   Note: The title does not have to be
*   the complete title that appears
*
*
* API Declarations
DECLARE INTEGER GetActiveWindow IN Win32API
DECLARE INTEGER GetWindow IN Win32API;
  INTEGER hwnd, INTEGER dflag
DECLARE INTEGER GetWindowText IN Win32API ;
  INTEGER hwnd, STRING @lptstr, INTEGER cbmax

LOCAL lnhwnd, lnnext, lldone, lctitle_bar, lcsearchfor,;
  lntext_len
lcsearchfor = UPPER(ALLTRIM(pctitle))
lnhwnd = GetActiveWindow()
lnnext = 2
lldone = .F.
lctitle_bar = ""
DO WHILE NOT lldone
  IF NOT EMPTY(lnhwnd)
    lctitle_bar = SPACE(200) + CHR(0)
    lntext_len = GetWindowText(lnhwnd, @lctitle_bar, 200)
    lctitle_bar = UPPER(LEFT(lctitle_bar, lntext_len))
    lldone = (lcsearchfor $ lctitle_bar)
    IF NOT lldone
      lnhwnd = GetWindow(lnhwnd, lnnext)
    ENDIF
  ELSE
    lldone = .T.
  ENDIF
ENDDO
RETURN lnhwnd
?is_run32 ('MICROSOFT WORD')
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform