Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Running a macro

This worked ok for me--it stopped it each time the shift key was held (is that
what you wanted?):

Option Explicit
Declare Function GetKeyState32 Lib "user32" Alias _
"GetKeyState" (ByVal vKey As Integer) As Integer
Sub testme()

Dim myShape As Shape
If GetKeyState32(16) < 0 Then
MsgBox "not this time buddy!"
Exit Sub
End If

Set myShape = ActiveSheet.Shapes(Application.Caller)

MsgBox myShape.TopLeftCell.Address

End Sub




Sheldon wrote:

Well, I figured out that I can use GetKeyState. All I need now is to reset
the KetState. In other words, the first time the macro works correctly. But
after that, the macro runs whether the shift key is pressed or not.

So How do I reset?

Thanks

"Sheldon" wrote:

In a worksheet I have a drawing object (rectangle) tied to macro. I want to
macro to run ONLY if the SHIFT key is pressed and the drawing object is
clicked. How can I do this?

Thanks


--

Dave Peterson

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
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
disable user running macro from Tools Macro Steve Simons Excel Discussion (Misc queries) 4 September 28th 06 06:28 AM
how to get onkey macro to fire while another macro is running Brian Murphy Excel Programming 8 August 25th 04 05:38 AM
running a macro ina workbook that doesnt have that macro Paul Excel Programming 2 February 18th 04 01:47 AM
Launch Macro in Access via Macro running in Excel??? dgrant Excel Programming 1 September 24th 03 01:38 PM


All times are GMT +1. The time now is 08:53 AM.

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

About Us

"It's about Microsoft Excel"