TPE
![]() |
![]() |
![]() |
|
|
Tavvafi@gmail.com |
|||
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
هر چند این موضوع از موارد پیشرفته و گسترش یافته Powerpoint به شما می رود چه رسد به اینکه بخواهیم برای این موضوع کدنویسی هم انجام دهیم.
در اینجا یک مثال ساده از چگونگی دسترسی به داده ها از یک کاربرگ اکسل جاسازی شده در یک اسلاید PPT را بررسی کرده ایم.
خطاهای موجود را بررسی کنید و مطمئن شوی که کاربرگ باز باشد.
Sub GetXLSWorksheetDataExample()
' This assumes you've set a reference to the MS Excel object library in the IDE
Dim oWorkbook As Excel.Workbook
Dim oWorksheet As Excel.Worksheet
Dim oSh As Shape
Dim LastCol As Long
Dim LastRow As Long
Dim x As Long
Dim y As Long
' This example assumes you've selected the excel object
' you want to work with
Set oSh = ActiveWindow.Selection.ShapeRange(1)
Set oWorkbook = oSh.OLEFormat.Object
' Use the first sheet in the work book
Set oWorksheet = oWorkbook.worksheets(1)
' Get the last row/col
With oWorksheet
.Activate
' Find the extents of the data in the sheet
LastRow = .Range("a65535").End(xlUp).Row
LastCol = .Range("iv1").End(xlToLeft).Column
' Display the data
For x = 1 To LastRow
For y = 1 To LastCol
Debug.Print "Row" & CStr(x) & ":Col" & CStr(y) & " " & .Cells(x, y)
Next
Next
End With
oWorkbook.Close (False)
Set oWorkbook = Nothing
Set oWorksheet = Nothing
End Sub



































