Customizing the menus in OWC

D

D.E.

Hi,

I have the following code to customize the menu in a pivot table in an html
page. (I followed the documentation at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnowc/html/odc_ocwebCustmUI.asp)
The menu is shown correctly and the Copy, Sort Ascending and Descending work
properly.
But the "Calculated Totals and Fields" and "Show As" do not work at all.
Actually do nothing.
Any ideas?

D.E.

----------------------------------------------------------------------------
----------------------------
<script language=vbscript>
Sub PivotTable1_BeforeContextMenu(x, y, Menu, Cancel)
Const CMD_PREFIX = "owc"
Dim vntMenu(6)
Dim ssConstants
Set ssConstants = PivotTable1.Constants

vntMenu(0) = Array("&Copy", CMD_PREFIX & ssConstants.ocCommandCopy)
vntMenu(1) = Empty
vntMenu(2) = Array("Sort &Ascending", CMD_PREFIX &
ssConstants.ocCommandSortAsc)
vntMenu(3) = Array("Sort Desce&nding", CMD_PREFIX &
ssConstants.ocCommandSortDesc)
vntMenu(4) = Empty
vntMenu(5) = Array("Calculated Totals and Fields", CMD_PREFIX &
ssConstants.plCommandCalculated)
vntMenu(6) = Array("Show As", CMD_PREFIX & ssConstants.plCommandShowAs)
Menu.Value = vntMenu
End Sub
Sub PivotTable1_CommandBeforeExecute(Command, Succeeded)
Const CMD_PREFIX = "owc"
Dim ssConstants
Set ssConstants = PivotTable1.Constants
If VarType(Command) = vbString Then
Select Case Command
Case CMD_PREFIX & ssConstants.ocCommandCopy
PivotTable1.Commands(ssConstants.ocCommandCopy).Execute
Case CMD_PREFIX & ssConstants.ocCommandSortAsc
PivotTable1.Commands(ssConstants.ocCommandSortAsc).Execute
Case CMD_PREFIX & ssConstants.ocCommandSortDesc
PivotTable1.Commands(ssConstants.ocCommandSortDesc).Execute
Case CMD_PREFIX & ssConstants.plCommandCalculated
PivotTable1.Commands(ssConstants.plCommandCalculated).Execute
Case CMD_PREFIX & ssConstants.plCommandShowAs
PivotTable1.Commands(ssConstants.plCommandShowAs).Execute
End Select
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top