Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default create pivot chart in vbscript

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default create pivot chart in vbscript

On 4 Mar, 19:41, T2A4D 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
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
Set a reference to Microsoft VBScript Regular Expressions(vbscript.dll) cate Excel Programming 2 December 1st 09 03:07 PM
How to create chart from Pivot table but not Pivot chart? Daniel Charts and Charting in Excel 1 July 31st 07 01:32 AM
create line chart with two axises in Pivot Chart HuaXC Charts and Charting in Excel 1 February 21st 07 08:28 PM
How can you create a Pivot Table using vbscript jtvbs Excel Programming 4 September 27th 04 06:59 AM
Using VBScript to create Excel SS and sort by column. KevinW Excel Programming 0 December 29th 03 09:01 PM


All times are GMT +1. The time now is 09:31 AM.

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

About Us

"It's about Microsoft Excel"