General information
Category:
Windows API functions
Title:
Execution de Word 6.0 masqué à partir d'API
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 ?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only