How can I export or copy charts to power point?

G

Guest

Hi I have 1 workbook which contains 4 sheets. Each sheet has 2 charts and I
want all that charts in each sheet to copy them or export them to powerpoint.
I want to do that by VBA Excel Code. I already have my code for opening the
specific ppt file. But I cannot transfer/copy/export the charts. Is there any
help please?
I put my code for opening the ppt file.

Sub openppt()
Dim Brocoli As Object
Dim Potato As Object
Dim carot As String

carot = "C:\Test\THIS IS A TEST.ppt"

Set Brocoli = CreateObject("powerpoint.Application")
Brocoli.Visible = True
Set Potato = Brocoli.Presentations.Open(Filename:=carot)
Call copycharts

End Sub
 
G

Guest

Also here is my code for transfer charts is that right?
An error "Object doesnt support this property or method" is given
Public Function Test()
Dim xl As Excel.Application
Dim wb As Workbook
Dim ws As Worksheet
'Dim i%

Set xl = New Excel.Application
Set wb = xl.Workbooks.Open("C:\Test\SEQS.xls")
Set ws = wb.Worksheets(1)

With ActiveWindow.Selection.SlideRange
For i = 1 To 3
.Shapes("Rectangle 2").TextFrame.TextRange.Text = ws.Cells(i,
1).Value
.Shapes("Rectangle 3").TextFrame.TextRange.Text = ws.Cells(i,
2).Value
ActiveWindow.Presentation.PrintOut 1, 1
Next i
End With

Set ws = Nothing
wb.Close SaveChanges:=False
Set wb = Nothing
xl.Quit
Set xl = Nothing

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top