PDA

View Full Version : Solved: Text from PowerPoint to Excel



gsdonald
10-06-2005, 10:20 PM
Hi all,
Here's another problem that has me stumped ...
I'm trying to transfer data from a PowerPoint file to an Excel one using the following code, but I keep getting errors.
Any ideas?


Private Sub CommandButton1_Click()
Dim myVocab As Object
Dim myfullPath As String
myfullPath = ActivePresentation.Path & "\Task.xls" 'Excel file

Set myVocab = GetObject(myfullPath)
With myVocab
.Application.Activate
.Application.Visible = True

With ActiveWorkbook
.Sheets("Grid").Range("A2") = "14" 'Text to transfer

End With
End With
End Sub

Bob Phillips
10-11-2005, 06:38 AM
How about


Private Sub CommandButton1_Click()
Dim myVocab As Object
Dim myfullPath As String
myfullPath = ActivePresentation.Path & "\Task.xls" 'Excel file

Set myVocab = GetObject(myfullPath)
With myVocab
.Activate
.Windows(1).Visible = True

.Sheets("Grid").Range("A2") = "14" 'Text to transfer
End With

myVocab.Close
Set myVocab = Nothing

End Sub