Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Execution de Word 6.0 masqué à partir d'API
Message
 
To
27/05/1998 09:51:24
Cpam Cpam
Cpam de Rouen
Rouen, France
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00102349
Message ID:
00102677
Views:
18
>J'utilise Word 6.0 à partir de VB pour éditer un document courant. Je n'arrive pas à quitter Word automatiquement après l'édition du document. Veuillez ci-joint la fonction utilisée:
>
>Option Explicit
>Declare Function SendMessage& Lib « user » (ByVal hwnd%, ByVal wMsg%, Byval wParm%, ByVal lParam AS Long)
>Declare Function WinExec Lib « Kernel » (ByVal lpCmdLine As String, ByVal nCmdShow As Integer) As Integer
>Declare Function GetModuleHandle Lib « Kernel » (ByVal lpModuleName As String) As Integer
>Declare Function ShowWindow Lib « user » (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
>
>Sub ExecMasqueWord6()
>
>Dim WordBasicObj As Object
>Dim WordObj As Object
>Dim hInst As Integer
>Dim Winword_hnd As Integer
>Dim x As Integer
>Const SW_HIDE = 0
>Const NILL = 0&
>Const WM_SYSCOMMAND = &H112
>Const SC_CLOSE = &HF060
>
>HInst = WinExec(« Winword.exe »,SW_HIDE)
>‘ * Execution de Word en masqué
>Winword_hnd = GetModuleHandle(« winword.exe »)
>‘ * lecture de l’objet document word
>Set WordObj = GetObject(« « , »Word.document.6 »)
>‘ * lecture de l’objet document WordBasic
>Set WordBasicObj = WordObj.Application.WordBasic
>‘ * Impressio du document courant
>WordBasicObj.FichierImprimerDefaut
>‘ * Suppression de l’objet WordBasic
>Set WordBasicObj = Nothing
>
>COMMENT FERMER Word 6 ?


Avant la ligne:
Set WordBasicObj = Nothing

Essaie de mettre la ligne suivante:
WordObj.Quit SaveChanges:=False

Quit est une méthode de l'objet application de Word. Le paramètre SaveChanges indique de ne pas poser de question à l'utilisateur (si le document à été modifié).
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform