method 'worksheets' of object '_global' failed on my code. from Excel to Power Point

I'm getting an error "method 'worksheets' of object '_global' failed on my code." and the following is highlighted in yellow:
Worksheets("PENDING_REV_REPORT").Range("A1:F28").CopyPicture _
Appearance:=xlScreen, Format:=xlPicture

What I'm trying to do is get an excel sheet range to a powerpoint slide.  Below is the code I'm using.

Sub CopyRangeToPresentation()

Dim PP As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim SlideTitle As String

Set PP = New PowerPoint.Application
Set PPPres = PP.Presentations.Add
PP.Visible = True

Set PPSlide = PPPres.Slides.Add(1, ppLayoutTitleOnly)

Worksheets("PENDING_REV_REPORT").Range("A1:F28").CopyPicture _
Appearance:=xlScreen, Format:=xlPicture

PP.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PP.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True

SlideTitle = "My First PowerPoint Slide"
PPSlide.Shapes.Title.TextFrame.TextRange.Text = SlideTitle

Set PPSlide = Nothing
Set PPPres = Nothing
Set PP = Nothing

End Sub
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

NorieAnalyst Assistant Commented:
Have you checked there is a sheet with the exact name 'PENDING_REV_REPORT' in the active workbook?
LUIS FREUNDAuthor Commented:
Wayne Taylor (webtubbs)Commented:
Try specifying the workbook as well...

ThisWorkbook.Worksheets("PENDING_REV_REPORT").Range("A1:F28").CopyPicture _
 Appearance:=xlScreen, Format:=xlPicture

Open in new window

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

NorieAnalyst Assistant Commented:
The only reason for the described error is that there is no worksheet with that exact name in the currently active workbook.

Adding a workbook reference, as Wayne suggests, might work.
Wayne Taylor (webtubbs)Commented:
You'll get a "Subscript out of range" error if it can't find the worksheet. Typically the above error occurs when not fully referencing the correct objects, in this case probably the workbook, or maybe even the Excel application.

Is this code being run from the workbook containing worksheet "PENDING_REV_REPORT"?

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
NorieAnalyst Assistant Commented:

Oops, you are right - for some reason I thought the code was being run from outside Excel and the error was something 'generic'.
LUIS FREUNDAuthor Commented:
Thanks Guys....
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
Microsoft Office

From novice to tech pro — start learning today.