|
楼主 |
发表于 2009-9-30 10:22:02
|
显示全部楼层
Sub listQSobject()
'define Folder
Dim Folder As String
Folder = "D:\QS\" 'QuickStart PPT FILE folder
'define fine name and get PPT file list from folder
Dim FileName As String
FileName = Dir(Folder + "*.PPT")
Dim NextFileName As String
' open current PPT file
'Presentations.Open FileName:=Folder + FileName, ReadOnly:=msoFalse
Do While FileName <> ""
NextFileName = Folder + FileName
Presentations.Open FileName:=NextFileName, ReadOnly:=msoFalse
'SlidesCount = ActiveWindow.Presentation.Slides.Count
Open NextFileName + ".txt" For Output As #1 'output txt file folder
Dim shpTextArray() As Variant
Dim numShapes, numAutoShapes, i As Long
Dim MsgName, MsgText As String
Dim MsgLeft, MsgRight As String
Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes
numShapes = .Count
If numShapes > 1 Then
numTextShapes = 0
'ReDim shpTextArray(1 To 2, 1 To numShapes)
For i = 1 To numShapes
If .Item(i).HasTextFrame Then
'numTextShapes = numTextShapes + 1
'shpTextArray(numTextShapes, 1) = .Item(i).Name
'shpTextArray(numTextShapes, 2) = .Item(i).TextFrame.TextRange.Text
MsgName = "AutoShap Name: " + .Item(i).Name
MsgText = "AutoShap Text: " + .Item(i).TextFrame.TextRange.Text
MsgLeft = "Left :" + Str(.Item(i).Left)
MsgRight = "Top: " + Str(.Item(i).Top)
'Response = MsgBox(MsgName, 0)
'Response = MsgBox(MsgText, 0)
'open file and write it
Print #1, MsgName
Print #1, MsgText
Print #1, MsgLeft
Print #1, MsgRight
End If
Next
'ReDim Preserve shpTextArray(1 To 2, 1 To numTextShapes)
End If
End With
ActiveWindow.Presentation.Close
FileName = Dir
Close #1
Loop
End Sub |
|