Pause Until Mouseclick?

G

Guest

I am working on a reporting dashboard and have created a series of dynamic
charts & graphs with conditional Red/Yellow/Green backgrounds and used the
"camera" feature to capture images which I have reduced to 20% their viewing
size.

I then located these "minimized" images on my dashboard and created a macro,
which is associated with the image, so that when clicked the image gets
maximized or magnigfied for viewing purposes. This way, my directors can see
a lot of data and only drill down on the metrics that are of interest to
them, as indicated by the color scheme.

Instead of creating two macros, I figured it would be far easier to
maximize, pause and then return the image to it's minimized state. I want the
pause to last only until the user clicks their mouse again.

Here's the code I am using now:

Sub TempMag()
'Select the image and format picture scale to 100%
ActiveSheet.Shapes("Picture 53").Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 431.25
Selection.ShapeRange.Width = 356.25
Selection.ShapeRange.Rotation = 0#

'I need code here that simply pauses and waits
'for the user to click their mouse again...

'Return the image to it's 20% minimized position
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 86.25
Selection.ShapeRange.Width = 71.25
Selection.ShapeRange.Rotation = 0#
Cell(A1).Select
End Sub

As always, thanks!
Ray
Trying to make reporting so easy... a monkey could run them!
 
G

Guest

1. put a picture on the worksheet
2. right-click the picture and select:
View Code
You can either associate a macro with the picture or assign the picture to a
macro in a standard module.
 
D

Doug Glancy

Ray,

I think the pausing idea is tough to execute, you'd have to use OnTime, I
think, and I always try to avoid using that if possible.

I think the code below will give you a start. It assumes you have 5 pics on
Sheet1, named "Picture 1", "Picture 2", etc.. It simply toggles each
clicked picture to be bigger or smaller. I've never actually used a static
variable, but I think it's what's needed here:

Sub PicClick()
Static blnPicIsMagnified(1 To 5) As Boolean ' adjust for number of pics
Const MAGNIFICATION_FACTOR As Long = 5' adjust to change magnification

blnPicIsMagnified(Replace(Application.Caller, "Picture ", "")) = _
Not blnPicIsMagnified(Replace(Application.Caller, "Picture ", ""))
With Worksheets(1).Shapes(Application.Caller)
If blnPicIsMagnified(Replace(Application.Caller, "Picture ", "")) Then
.Height = .Height * MAGNIFICATION_FACTOR 'assumes aspect ratio is
locked, width will follow
Else
.Height = .Height / MAGNIFICATION_FACTOR
End If
End With
End Sub

hth,

Doug
 
G

Guest

Isn't this exactly how a MsgBox works? I'm not sure if that's what you're
shooting for but if the box wouldn't block the data you're trying to show I
think it will work just fine. You could add a line of explanatory text like
"Click OK to ..."
 

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