Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Permit DoubleClick but prevent other editing

Is it possible to limit a user's interaction with an embedded chart to
the
double-click (DoubleClick) event (from which a macro would be run)?
As far as I can make out, Excel's protection facilities - despite the
various .Protect* properties of a Sheet or Chart - will always put
DoubleClicking in the same category as formatting.

If it's not directly possible, I suppose I'm interested in
workarounds, but my customer wanted to have this particular type of of
user-interaction. At present, the chart itself is all that needs to
be selected. In future releases, it would be good to be able to
select a chart data point and provide a report or 'drill-down' view.
The design works well without protection, using the chart's
BeforeDoubleClick event: can this be made to work whilst we lock all
control of the chart formatting?

[revised version of original post to
microsoft.public.excel.programming]
  #2   Report Post  
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Permit DoubleClick but prevent other editing

David -

Run your macro off a single click, using this event procedure to detect
the click:

Private Sub EmbChart_MouseDown _
(ByVal Button As Long, ByVal Shift As Long, _
ByVal x As Long, ByVal y As Long)
ActiveChart.Deselect
Windows(ActiveWorkbook.Name).Activate
ActiveCell.Select
Call myMacro(EmbChart, x, y)
End Sub

This works for an embedded chart because it immediately selects the
previous active cell, without letting anything happen to the chart, but
it still can be used to determine what chart element was clicked on.
Here's a dummy macro that determines what was clicked on:

Sub myMacro(myChart As Chart, myX As Long, myY As Long)
Dim ElementID As Long, Arg1 As Long, Arg2 As Long
myChart.GetChartElement myX, myY, ElementID, Arg1, Arg2
MsgBox "You've selected chart element " & ElementID & " (" _
& Arg1 & ", " & Arg2 & ")."
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

David Powell wrote:
Is it possible to limit a user's interaction with an embedded chart to
the
double-click (DoubleClick) event (from which a macro would be run)?
As far as I can make out, Excel's protection facilities - despite the
various .Protect* properties of a Sheet or Chart - will always put
DoubleClicking in the same category as formatting.

If it's not directly possible, I suppose I'm interested in
workarounds, but my customer wanted to have this particular type of of
user-interaction. At present, the chart itself is all that needs to
be selected. In future releases, it would be good to be able to
select a chart data point and provide a report or 'drill-down' view.
The design works well without protection, using the chart's
BeforeDoubleClick event: can this be made to work whilst we lock all
control of the chart formatting?

[revised version of original post to
microsoft.public.excel.programming]


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
Removing protections that prevent me from editing formulas. Tom Excel Worksheet Functions 2 December 23rd 09 04:18 PM
How to permit editing the contents of added row(cells) if previous row is protected? [email protected] Excel Discussion (Misc queries) 1 January 19th 09 10:57 PM
How to prevent editing within a specific cells? Eric Excel Discussion (Misc queries) 1 October 24th 08 05:17 AM
prevent pivot tables / charts from editing Peter Excel Discussion (Misc queries) 1 July 15th 08 04:12 PM
How do I prevent editing in a cell based on the value in another? LEA Excel Worksheet Functions 0 November 8th 06 05:21 PM


All times are GMT +1. The time now is 12:02 AM.

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

About Us

"It's about Microsoft Excel"