Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select certain data from a Pivot and copy this into Powerpoint

Hi,

I've got a problem with selecting certain data from a Pivot table and
to copy this data into Powerpoint.

The macro has to select the following data from the Pivot:
Column 1: ABX
Column 2: wk01-2006

I'm currently using these lines, but the problem is that the macro also
selects other data from the pivot which i don't need. The only other
option I've got is to give in some lines which switch of all other data
in the pivot. Unfortunately i've got a lot of colums so this will cost
me a lot of time.

Does anybody knows a shorter way to do this?

Greetz Perry

Dim objPrs As Object
Dim objGraph As Object
Dim objDataSheet As Object
Dim rngData As Range
Dim intRow As Integer
Dim intCol As Integer
Dim PPSlide As PowerPoint.Slide
Dim PPPres As PowerPoint.Presentation
Dim PPApp As PowerPoint.Application
Dim PresentationFileName As Variant
Dim SlideCount As Long
Dim iCht As Integer

' open powerpoint
' Set objPPT = CreateObject("Powerpoint.application")
Set PPApp = CreateObject("Powerpoint.application")
PPApp.Visible = True
PPApp.Presentations.Open ThisWorkbook.Path & "\Template.ppt"
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

SlideCount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides(3)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex

Windows("Exception Overview KPI Reporters.xls").Activate
Sheets("Pivot PU").Select
ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("Carrier")
.PivotItems("ABX").Visible = True
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("Week")
.PivotItems("wk01-2006").Visible = True
End With

ActiveSheet.Range("J4").Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Range(Selection, Selection.End(xlToLeft)).Select
Selection.CopyPicture xlScreen, xlPicture

With PPSlide
' paste and select the chart picture
.Shapes.Paste.Select
' align the chart
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters,
True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles,
True
End With
' Next

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Select certain data from a Pivot and copy this into Powerpoint

If you use code like this:

ActiveSheet.Range("J4").Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Range(Selection, Selection.End(xlToLeft)).Select
Selection.CopyPicture xlScreen, xlPicture


your pretty much stuck with what it picks up. If you know more about the
structure of the data, then perhaps you can use a smarter algorithm to get
the area you want.



--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hi,

I've got a problem with selecting certain data from a Pivot table and
to copy this data into Powerpoint.

The macro has to select the following data from the Pivot:
Column 1: ABX
Column 2: wk01-2006

I'm currently using these lines, but the problem is that the macro also
selects other data from the pivot which i don't need. The only other
option I've got is to give in some lines which switch of all other data
in the pivot. Unfortunately i've got a lot of colums so this will cost
me a lot of time.

Does anybody knows a shorter way to do this?

Greetz Perry

Dim objPrs As Object
Dim objGraph As Object
Dim objDataSheet As Object
Dim rngData As Range
Dim intRow As Integer
Dim intCol As Integer
Dim PPSlide As PowerPoint.Slide
Dim PPPres As PowerPoint.Presentation
Dim PPApp As PowerPoint.Application
Dim PresentationFileName As Variant
Dim SlideCount As Long
Dim iCht As Integer

' open powerpoint
' Set objPPT = CreateObject("Powerpoint.application")
Set PPApp = CreateObject("Powerpoint.application")
PPApp.Visible = True
PPApp.Presentations.Open ThisWorkbook.Path & "\Template.ppt"
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

SlideCount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides(3)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex

Windows("Exception Overview KPI Reporters.xls").Activate
Sheets("Pivot PU").Select
ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("Carrier")
.PivotItems("ABX").Visible = True
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("Week")
.PivotItems("wk01-2006").Visible = True
End With

ActiveSheet.Range("J4").Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Range(Selection, Selection.End(xlToLeft)).Select
Selection.CopyPicture xlScreen, xlPicture

With PPSlide
' paste and select the chart picture
.Shapes.Paste.Select
' align the chart
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters,
True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles,
True
End With
' Next



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to select and copy rows only containing data shaz0503 Excel Discussion (Misc queries) 5 October 10th 08 01:58 AM
Can I select data in several Worksheets for a Pivot Table? DR1Home Charts and Charting in Excel 1 March 18th 08 05:33 PM
I can not select Pivot Table on my Data Menu Trooper's Wife Excel Discussion (Misc queries) 2 November 22nd 05 10:19 PM
find specific data in row and select and copy entirerow Junior728 Excel Programming 3 August 8th 05 01:31 PM
Pivot Tables, can I use an external list to select data items? Brian Lofquist Excel Worksheet Functions 0 January 4th 05 06:43 PM


All times are GMT +1. The time now is 08:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"