Export to Excel with PivotTable in vbScript

B

brian_madden

(first post sent by mistake)
Hi,
..Net 1.1, OWC10 (10.0.6619.0), XPPro SP1

I'm trying to add a custom context menu to a PivotTable control on an aspx
page. I can create the menu and fire off commands, but when I try to use the
Export to Excel command, I'm getting a permission denied script error. Can
this be done or am I doing something wrong? I've included the code below -

sub PivotTable1_BeforeContextMenu(x, y, Menu, Cancel)
dim vntMenu(1)
dim owcConsts

set owcConsts = Document.Forms(0).PivotTable1.Constants

vntMenu(0) = Array("Export", "owc" & owcConsts.ocCommandExport)
vntMenu(1) = Array("Help", "owc" & owcConsts.ocCommandHelp)

Menu.Value = vntMenu

end sub

Sub PivotTable1_CommandBeforeExecute(Command, Succeeded)

dim owcConsts

set owcConsts = Document.Forms(0).PivotTable1.Constants

if vartype(Command) = vbString then
select case Command
case "owc" & owcConsts.ocCommandExport
Document.Forms(0).PivotTable1.Commands(owcConsts.ocCommandExport).Execute

case "owc" & owcConsts.ocCommandHelp
Document.Forms(0).PivotTable1.Commands(owcConsts.ocCommandHelp).Execute

end select
end if

end sub

TIA,
Brian
 

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