Thanks Thanks:  0
Likes Likes:  0
Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: how to simulate mouse button press via VBA

  1. #1
    New Member
    Join Date
    Mar 2002
    Location
    Visalia, CA
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    hi all,
    i have a workbook that opens an other workbook by macro. i have a little mousepointer problem cause the mousepointer in the workbook opened by macro kind of jams and i need to press the right mouse button once in order to make it work normally. my question is how would i simulate this right mouse button pressing by VB code? could sendkey statement or something like that be used here?

    sorry for this oversized post, but thatīs the way i am

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Little Italy
    Posts
    93
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have the same exact problem, miss Excelina! I was wondering about that SendKeys thing too, posted a question here, didn't get any answers...

    Every time I saw a MVP or punch of Masters logged in, I put my post up again, but that didn't help, they locked my post! Those bastards! ; )

    Anyways, I really hope somebody takes you seriously and gives us something to work with, even simple "Don't go there" for that SendKeys statement would do, at least we could stop jerking around with it...

  3. #3
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    813
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    Do you want to make a Right Click on the document?

    If so just call RightDown sub wherever you need.

    Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
    Const MOUSEEVENTF_RIGHTDOWN = &H8
    Const MOUSEEVENTF_RIGHTUP = &H10

    Public Sub RightDown()
    mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
    mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
    End Sub

    regards
    Suat

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Little Italy
    Posts
    93
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    smozgur, thanks man!

    I don't know about Excelina, but for me it works like a charm!



  5. #5
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    At the risk of sounding smart, get a new mouse!



  6. #6
    Board Regular Barry Katcher's Avatar
    Join Date
    Feb 2002
    Location
    Dog Beach, Florida. Yeaahh!
    Posts
    4,053
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Dave, would that be something like this?:

    Sub Born_To_Shop()

    GoTo_RadioShack = True
    Purchase_Mouse = True

    End Sub

  7. #7
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    813
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Sbirro Cornuto,

    Actually i'd like to see your code to find possible solution to avoid it without using right click.

    It is nice to hear that it works for you.
    Suat

  8. #8
    Board Regular
    Join Date
    Mar 2002
    Location
    Little Italy
    Posts
    93
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Don't worry Dave, I don't see how you could ever sound smart.

    Here's little explanation for you wiseasses:

    There is nothing wrong with my mouse or with Excelina's (I'm guessing). I just need to automate that Mouse Button event, cause I have few workbooks opening each other through VBA and VB code and there is a lot of Cursor playing in there also, mostly with ani-files. The Cursor changes however wont work everytime without a right click from the mouse and since this is all suppose to be done automaticly I need to automate that mouse click in there, too.

    I hope this is all right with you, Dave. And I must warn you that I might ask something else concerning Excel automation in this forum in the future, so if I'm in someway bothering you, feel free to skip my topics...

  9. #9
    Board Regular
    Join Date
    Mar 2002
    Location
    Little Italy
    Posts
    93
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-26 06:00, smozgur wrote:
    Hi Sbirro Cornuto,

    Actually i'd like to see your code to find possible solution to avoid it without using right click.

    It is nice to hear that it works for you.
    Thanks for the offer smozgur, but your code really works all right and I don't want to make so many changes to the ani-file loading procedures to avoid this MousePointer jamming, so relax and take the pleasure of knowing that you really have helped a lot. You are awesome!

  10. #10
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Wow Sbirro Cornuto,

    You should try relaxing a bit.


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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