Excel ouvrire un fichier word

Résolu/Fermé
tas6705 - 4 avril 2011 à 17:29
 tas6705 - 4 avril 2011 à 20:18
Bonjour,

sous VBA : Je voudrai ouvrir un fichier Word "C:\Documents and Settings\cochoum\My Document\Rapport.doc" juste en appuyant sur un commandbox.

Ps: je suis sous XP et office 2003.

Merci d'avance.


A voir également:

2 réponses

dominiquedfci
4 avril 2011 à 20:03
Bonsoir,

Après avoir référencé la bibliothèque :

Microsoft Word 12 Object Library dans outils / références

Saisie le code suivant :

dans la partie Général / déclarations :

Option Explicit
'Déclaration des variables
Dim wApp As Word.Application
Dim wDoc As Word.Document


créer une nouvelle procédure de type SUB :

Public Sub Ouverture_Fichier()

Set wApp = CreateObject("Word.Application")
wApp.Visible = True
'set wdoc=wapp.Documents.Open "<chemin d'access + nom du fichier>"
' autres instructions ...


End Sub
0
Merci beaucoup ca marche nickel !
0