PC Review


Reply
Thread Tools Rate Thread

create pivot chart in vbscript

 
 
T2A4D
Guest
Posts: n/a
 
      4th Mar 2010
Hello:

I'm having trouble creating a pivot chart using vbscript. I have a vbscript
that pulls info from AD and dumps it into Excel. I currently add the pivot
chart manually to each report, but wanted to automate it. Is this possible?
 
Reply With Quote
 
 
 
 
deltaquattro
Guest
Posts: n/a
 
      5th Mar 2010
On 4 Mar, 19:41, T2A4D <T2...@discussions.microsoft.com> wrote:
> Hello:
>
> I'm having trouble creating a pivot chart using vbscript. I have a vbscript
> that pulls info from AD and dumps it into Excel. I currently add the pivot
> chart manually to each report, but wanted to automate it. Is this possible?


Oooh, my first occasion to return the help I received on the ng
First of all, what's AD?
Pivot charts are very easy, but Pivot Tables (from which Pivot Charts
are created) are not so simple, so you might want to play with the
Macro recorder for some time before writing your own macro. Anyway, I
assume that you already know about PivotCaches, PivotTables and all
that jazz. Let's go straight to Pivot Charts:

Sub AddPivotChart(PT As PivotTable, ChartName As String, cht As Chart)
' Add a PivotChart associated with PivotTable PT

' First of all, create a chart sheet for your Pivot Chart: I have my
own "safe" Add Chart routine,
' you can use yours or just use the Charts.Add method, even though
that's no so safe
Call AddChart(ChartName, cht)

With cht

'Pivot Chart Name
.Name = ChartName
'A Chart becomes a Pivot Chart, basically, when you set the
SourceData to a PivotTable
.SetSourceData Source:=PT.TableRange1

'Add title
.HasTitle = True
.ChartTitle.text = ChartName

'Change format to what suits your chart best
.ChartType = xlLineMarkers

End With

End Sub

Hope this helps,

Sergio Rossi (deltaquattro)
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create chart from Pivot table but not Pivot chart? =?Utf-8?B?RGFuaWVs?= Microsoft Excel Charting 1 31st Jul 2007 01:32 AM
create line chart with two axises in Pivot Chart =?Utf-8?B?SHVhWEM=?= Microsoft Excel Charting 1 21st Feb 2007 08:28 PM
How do I create a custom scroll bar on a 3D Pivot Chart? =?Utf-8?B?SlJXIGluIElkYWhv?= Microsoft Excel Charting 1 1st Dec 2004 08:55 PM
Can I create more than one chart from the same pivot table? =?Utf-8?B?Sm9oYW5h?= Microsoft Excel Charting 1 28th Oct 2004 11:16 PM
How can you create a Pivot Table using vbscript =?Utf-8?B?anR2YnM=?= Microsoft Excel Programming 4 27th Sep 2004 06:59 AM


Features
 

Advertising
 

Newsgroups
 


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