Simple Macro!

J

Jim

Hey hi,

it seem odd but since i've never used any macros , i was wondering if
someone can help me out.

I was going thru the samples in Office suite, and came across a macro code
that would enable a person to put a chart straight in to ppt file.

here it goes:

This example copies the chart from the Chart Labels sheet into a new
Microsoft PowerPoint presentation.


Sub MS_PowerPoint()
Dim ppt As Object, pres As Object
'Create a Microsoft PowerPoint session
Set ppt = CreateObject("powerpoint.application")
'Copy the chart on the Chart Labels Demo sheet
Worksheets("Chart Labeling").ChartObjects(1).Copy
'Create a new document in Microsoft PowerPoint
Set pres = ppt.Presentations.Add
'Add a slide
pres.Slides.Add 1, ppLayoutBlank
'Make PowerPoint visible
ppt.Visible = True
'Activate PowerPoint
AppActivate ppt.Name
'Paste the chart
ppt.ActiveWindow.View.Paste
Set ppt = Nothing
End Sub

Now i've the code but i dont know how to implement it. Please advise as i'd
be really greatful

Thanks
Jim
 
S

SeaparkJohn

Hi Jim,

In powerpoint, go to the grey menu space up the top, right click and select
Visual Basic from the menu. This will open a vb menu. Select code and the
Insert>Module. Now paste this code into the white screen that opens. Press
F5 to run the code. I think from reading the code that it requires other
demo sheets, possible excel, to run.

Hope this helps
 

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