Need to paste several worksheets into Powerpoint

Private Sub CommandButton1_Click()

I have several worksheets that I need to insert into slides in powerpoint.  I have a good start but need some help adding the "looping?" process to add all the worksheets in to the Powerpoint.  Worksheets are named "codrot"(which is in the code below) "codr" and " coot"

Thanks in advance.

'Sub PowerPointOLEAutomation()
 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("codrot").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
LSamuelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DabasCommented:
Hi LSamuel:
Although you have names for your Worksheets, each sheet also can be reached by its number

So very possibly Worksheets("Codrot") is the same as Worksheets(1)
And the other two will be Worksheets(2) and Worksheets(3) respectively

Taking that into account, it should be quite simple to build a loop

Dabas
LSamuelAuthor Commented:
Ok - I understand but do sure where to start the statements
Can you help get me started?  I understand taking out the "Codrot" and I did so and I replaced with "1".   Does the Do statement go before Worksheets ("1").... or after???? and where do I add the other Worksheets or is it a statement I use to do an Until statement?

Thanks.

Thanks in advance.

'Sub PowerPointOLEAutomation()
 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("1").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
DabasCommented:
Sub PowerPointOLEAutomation()
 Dim ppt As Object, pres As Object
    'Create a Microsoft PowerPoint session
    Set ppt = CreateObject("powerpoint.application")
       'Activate PowerPoint
        AppActivate ppt.Name 'Probably best to have it here?
    'Copy the chart on the Chart Labels Demo sheet
    For i = 1 to 3
        Worksheets(i).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
         'Paste the chart
        ppt.ActiveWindow.View.Paste
    Next
    Set ppt = Nothing
   
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

DabasCommented:
LSamuel:
Just a piece of friendly advice:

I notice you have a record of B grades in your profile.
If you want to motivate experts to help you, I would suggest you revise your policy of thanking them.
(I myself have enough points not to care, but being appreciated for my effort does give me just that bit of satisfaction)

Dabas
LSamuelAuthor Commented:
The grade B's are for comments like yours - I give A's for people who go beyond the effort to help and offer detail.  For I think the one's that offer the extended efforts deserve the better grade.  I give B's deservely and sorry you feel it is not motivation.  I pay for this service and expect to get the help I need.  I guess I am wrong.  I hope others on Expert's Exchange do not feel the same about a grade.
LSamuelAuthor Commented:
You should not of posted the comment about the grade at the end - I saw it only and added my comment then I saw you worked it out for me in the post before.  For help such as that I really appreciate and grade as A's and did so with you.  Thanks for the help - I will be able to see what was added and where and learn from it.  Thanks.
DabasCommented:
LSamuel:
I did not place my comment to entice you to give me an A. I just wanted to give you friendly advice so that the money you are paying for the service works the best for you. Having 8 of your last questions graded B may scare the one expert away that might know the answer to a future question.

I appreciate that you are paying for this service, but we experts do not see a cent.
The B grades appear on your profile. Not on the experts profile, so these grades are detrimental to you, as some experts do look at your record and say to themselves: "Why should I bother?"

I have looked at some of the B grades you have given. There are a few where an expert has given you a full answer. Others the expert is asking you further questions to gain clarity. In this particular question you came back and asked me for further clarification, which enabled me to give you a better answer. I do not think you gave other experts that chance to "Earn" their A.


Dabas
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.