Assign code to shape

J

Jacob

Hi,
I have an application which addss a bar chart to a new
workbook, adds a scroll bar to the chart and then assign
code to the scrollbar shape. The code assigned is written
on fly and placed in a general code module. When
executing the assignment with the following code I get an
error on the .OnAction statement (1004)

Charts(PlotName).Activate
Charts(PlotName).Shapes("Scroll Bar 1").Select
With Selection
.Value = 3
.Min = 3
.Max = Tpoints + 2
.SmallChange = 1
.LargeChange = Application.WorksheetFunction. _
Max(1, Tpoints / 500)
.Display3DShading = True
.Name = "scb_" & PlotName
.OnAction = SelectedBooks(0) & _
"!ScrollBarTime" & PlotName
End With

If, in the .OnAction statement, I do not qualify the name
of the sub with the workbook name where the code resides
I do not get an error, but the shape object can't find
the code as VBA has qualified it with the addin book
name. Is there a way around this?

Any help appreciated
 
J

jacob

Forget this one,
Sorry bout it but I'd forgotten to check for forbidden
charcters in the book name.
 

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