1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Public Sub ImportExcel()
'---------------------------------------------------------------------------------------
' Procedure : ImportExcel
' Auteur : Philippe JOCHMANS - http://starec.developpez.com
' Date : 12/04/2009
' Commentaires :
'---------------------------------------------------------------------------------------
'déclaration des variables
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim shpTexte As Shape
'ouverture du fichier Excel
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("C:\Users\Philippe\Desktop\test.xls")
Set xlSheet = xlBook.Sheets("Feuil1")
' on crée une zone de texte
Set shpTexte = ActivePresentation.Slides(1).Shapes.AddTextbox(msoTextOrientationHorizontal, 50, 50, 200, 50)
With shpTexte.TextFrame.TextRange
.Font.Bold = msoTrue
.Font.Size = 20
.Text = xlSheet.Range("A1").Value
End With
' Fermeture
xlApp.Quit
End Sub |
Partager