+ Reply to Thread
Results 1 to 7 of 7

ByVal Button As Integer, ByVal Shift As Integer

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-27-2006
    Posts
    310

    ByVal Button As Integer, ByVal Shift As Integer

    ByVal Button As Integer, ByVal Shift As Integer

    For activeX controls what are these two arguments and what are they used for ?

    Are they actually considered to be arguments ?

    ByVal X As Single and ByVal Y As Single give you the position of the mouse ,
    so unlike an argument you do not provide a value, instead they are variables giving you a value.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645
    What context are you using these in?

    A button event?

    Another event?

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello SuitedAces,

    These are indeed arguments. They are return values supplied by the event procedure. In this case, a Mouse Event. You can use these return values in your code to further refine the code operation. Button will identify which mouse button was clicked when the event was triggered. Shift will return a code that tells you which combination of keys (SHIFT, CTRL, and ALT) were pressed when the mouse was clicked.

    Arguments can be passed in two ways: ByVal, or ByRef. If ByRef is the default in VBA. This simply passes the address of the object as an argument. ByVal passes the entire object. I won't go into the "why" as it would require its own post to explain.

    Sincerely,
    Leith Ross

  4. #4
    Forum Contributor
    Join Date
    06-27-2006
    Posts
    310
    Quote Originally Posted by Leith Ross
    Hello SuitedAces,

    These are indeed arguments. They are return values supplied by the event procedure. In this case, a Mouse Event. You can use these return values in your code to further refine the code operation. Button will identify which mouse button was clicked when the event was triggered. Shift will return a code that tells you which combination of keys (SHIFT, CTRL, and ALT) were pressed when the mouse was clicked.

    Arguments can be passed in two ways: ByVal, or ByRef. If ByRef is the default in VBA. This simply passes the address of the object as an argument. ByVal passes the entire object. I won't go into the "why" as it would require its own post to explain.

    Sincerely,
    Leith Ross
    Ok Leith so are you saying that Shift will not give me a value unless I have one of the mouse buttons pressed before a key press(Shift,ctrl,Alt) ?

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello SuitedAces,

    The Shift argument in the Mouse Event is only returned when the Mouse Event fires. The Shift argument is also returned for Key Events (KeyDown, KeyPress, KeyUp). Again the value is returned only when the event takes places.

    Sincerely,
    Leith Ross

  6. #6
    Forum Contributor
    Join Date
    06-27-2006
    Posts
    310
    Leith thank you for your help once again

  7. #7
    Forum Contributor
    Join Date
    06-27-2006
    Posts
    310
    Quote Originally Posted by Norie
    What context are you using these in?

    A button event?

    Another event?
    yes I was looking at those in event for controls

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1