le contenu de chaque onglet actif (donc pas les onglets masqués) du classeur excel ouvert.
Set wbExcel = appExcel.Workbooks.Open("C:\MonFichierExcel.xls")
Set wbExcel = appExcel.Workbooks.Open(toto)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit Private Declare Function CloseClipboard Lib "user32" () As Long Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function EmptyClipboard Lib "user32" () As Long Private Sub Macro1() ' Objet de la macro : rapatrier les onglets non masqués dans un document word Dim finput As FileDialog Dim Chemin As String Dim appExcel As Object Dim wbExcel As Object Dim wsExcel As Object Set finput = Application.FileDialog(msoFileDialogOpen) finput.Show Chemin = finput.SelectedItems(1) Set appExcel = CreateObject("Excel.application") Set wbExcel = appExcel.Workbooks.Open(Chemin) Set wsExcel = wbExcel.ActiveSheet If Sheets("Feuil1").Visible = True Then Sheets("Feuil1").Range("A3:F20").Copy Selection.GoTo What:=wdGoToBookmark, Name:="TEST" Selection.PasteSpecial , DataType:=wdPasteBitmap 'vidage du presse papier OpenClipboard 0 EmptyClipboard CloseClipboard End If If Sheets("Feuil2").Visible = True Then Sheets("Feuil2").Range("A1:E10").Copy Selection.GoTo What:=wdGoToBookmark, Name:="TEST1" Selection.PasteSpecial , DataType:=wdPasteBitmap OpenClipboard 0 EmptyClipboard CloseClipboard End If ' suite du code ... 'wbExcel.Save wbExcel.Close appExcel.Quit Set wsExcel = Nothing Set wbExcel = Nothing Set appExcel = Nothing End Sub