cs_djjoss
Messages postés1Date d'inscriptionvendredi 26 mars 2004StatutMembreDernière intervention19 janvier 2005 19 janv. 2005 à 18:34
Bonjour,
Cette macro te permet de selectionner la zone à envoyer vers word
Sub CopiePlageAutoExcelWord()
Dim PlageACopier As Range
Dim AppWord As Object
'Sheets("NomFeuille").Activate
If WorksheetFunction.CountA(Cells) > 0 Then
On Error Resume Next
Set PlageACopier = Application.InputBox(Prompt:="Sélectionner votre zone: (Ex. A1:B10) ", _
Title:="Sélection de zone ", Default:="$A$1", Type:=8)
On Error GoTo 0
If PlageACopier Is Nothing Then Exit Sub
'Automatique à partir de A1 jusqu'à la fin
'Set PlageACopier = Range("A1", Cells.Find("*", , , , , xlPrevious))
Else
MsgBox "La feuille ne contient pas de données"
Exit Sub
End If
Set AppWord = CreateObject("Word.Application")
PlageACopier.Copy
With AppWord
.Visible = True
.documents.Add
'.documents.Open Filename:="C:\ajeter\docAOuvrir.doc"
.Selection.Paste
End With
'ActiveWorkbook.Save
'Application.Quit
End Sub