Microsoft Excel

Herbers Excel/VBA-Archiv

Maus klicken

    Betrifft: Maus klicken von: chris b
    Geschrieben am: 26.08.2003 15:26:09

    Kann mir da jemand helfen ??
    Programm soll nur eins machen auf der Position,
    x = 955
    y = 20
    ist ein Explorer offen und da ist das X zum schliesen, das programm sol nur auf das x klicken macht es aber nicht? Wäre super wenn mir jemand einen tipp geben kann ! Danke Christian

    'keybd_event dwFlags-Konstanten
    Private Const KEYEVENTF_KEYUP = &H2 'Die angegebene Taste wird losgelassen
    Private Declare

    Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    Private Declare 
    Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Private Const KEYEVENTF_EXTENDEDKEY = &H1 'Erweiterte Tastatureingabe
     
    'GetAsyncKeyState vKey-Konstanten
    Private Const VK_LBUTTON = &H1 'Linker Mausbutton
    Private Const VK_RBUTTON = &H2 'Rechter Mausbutton
    Private Const VK_MBUTTON = &H4 'Mittlerer Masubutton
    Private Const VK_BACK = &H8 'Backspace Taste
    Private Const VK_TAB = &H9 'Tab Taste
    Private Const VK_CLEAR = &HC 'Numpad 5 ohne Numlock
    Private Const VK_RETURN = &HD 'Enter Taste
    Private Const VK_SHIFT = &H10 'Shift Taste
    Private Const VK_CONTROL = &H11 'STRG Taste
    Private Const VK_MENU = &H12 'Alt Taste
    Private Const VK_PAUSE = &H13 'Pause/Untbr
    Private Const VK_CAPITAL = &H14 'Caps Lock/Feststelltaste
    Private Const VK_ESCAPE = &H1B 'Escape
    Private Const VK_SPACE = &H20 'Space/Leertaste
    Private Const VK_PRIOR = &H21 'PageUp/Bild hoch
    Private Const VK_NEXT = &H22 'PageDown/Bild runter
    Private Const VK_END = &H23 'Ende
    Private Const VK_HOME = &H24 'Home/Pos1
    Private Const VK_LEFT = &H25 'Linke Pfeiltaste
    Private Const VK_UP = &H26 'Obere Pfeilaste
    Private Const VK_RIGHT = &H27 'Rechte Pfeiltaste
    Private Const VK_DOWN = &H28 'Untee Pfeiltaste
    Private Const VK_PRINT = &H2A 'Drucken (Nokia Tastaturen)
    Private Const VK_SNAPSHOT = &H2C 'Drucken/S-Abf
    Private Const VK_INSERT = &H2D 'Einfügen
    Private Const VK_DELETE = &H2E 'Entfernen
    Private Const VK_HELP = &H2F 'Hilfe
    Private Const VK_0 = &H30 'Taste 0
    Private Const VK_1 = &H31 'Taste 1
    Private Const VK_2 = &H32 'Taste 2
    Private Const VK_3 = &H33 'Taste 3
    Private Const VK_4 = &H34 'Taste 4
    Private Const VK_5 = &H35 'Taste 5
    Private Const VK_6 = &H36 'Taste 6
    Private Const VK_7 = &H37 'Taste 7
    Private Const VK_8 = &H38 'Taste 8
    Private Const VK_9 = &H39 'Taste 9
    Private Const VK_A = &H41 'Taste A
    Private Const VK_B = &H42 'Taste B
    Private Const VK_C = &H43 'Taste C
    Private Const VK_D = &H44 'Taste D
    Private Const VK_E = &H45 'Taste E
    Private Const VK_F = &H46 'Taste F
    Private Const VK_G = &H47 'Taste G
    Private Const VK_H = &H48 'Taste H
    Private Const VK_I = &H49 'Taste I
    Private Const VK_J = &H4A 'Taste J
    Private Const VK_K = &H4B 'Taste K
    Private Const VK_L = &H4C 'Taste L
    Private Const VK_M = &H4D 'Taste M
    Private Const VK_N = &H4E 'Taste N
    Private Const VK_O = &H4F 'Taste O
    Private Const VK_P = &H50 'Taste P
    Private Const VK_Q = &H51 'Taste Q
    Private Const VK_R = &H52 'Taste R
    Private Const VK_S = &H53 'Taste S
    Private Const VK_T = &H54 'Taste T
    Private Const VK_U = &H55 'Taste U
    Private Const VK_V = &H56 'Taste V
    Private Const VK_W = &H57 'Taste W
    Private Const VK_X = &H58 'Taste X
    Private Const VK_Y = &H59 'Taste Y
    Private Const VK_Z = &H5A 'Taste Z
    Private Const VK_STARTKEY = &H5B 'Startmenütaste
    Private Const VK_CONTEXTKEY = &H5D 'Kentextmenü
    Private Const VK_NUMPAD0 = &H60 'Numpad Taste 0
    Private Const VK_NUMPAD1 = &H61 'Numpad Taste 1
    Private Const VK_NUMPAD2 = &H62 'Numpad Taste 2
    Private Const VK_NUMPAD3 = &H63 'Numpad Taste 3
    Private Const VK_NUMPAD4 = &H64 'Numpad Taste 4
    Private Const VK_NUMPAD5 = &H65 'Numpad Taste 5
    Private Const VK_NUMPAD6 = &H66 'Numpad Taste 6
    Private Const VK_NUMPAD7 = &H67 'Numpad Taste 7
    Private Const VK_NUMPAD8 = &H68 'Numpad Taste 8
    Private Const VK_NUMPAD9 = &H69 'Numpad Taste 9
    Private Const VK_MULTIPLY = &H6A 'Numpad Multiplikations Taste (*)
    Private Const VK_ADD = &H6B 'Numpad Additions Taste (+)
    Private Const VK_SUBTRACT = &H6D 'Numpad Subtrations Taste (-)
    Private Const VK_DECIMAL = &H6E 'Numpad Komma Taste (,)
    Private Const VK_DIVIDE = &H6F 'Numpad Devidierungs Taste (/)
    Private Const VK_F1 = &H70 'F1 Taste
    Private Const VK_F2 = &H71 'F2 Taste
    Private Const VK_F3 = &H72 'F3 Taste
    Private Const VK_F4 = &H73 'F4 Taste
    Private Const VK_F5 = &H74 'F5 Taste
    Private Const VK_F6 = &H75 'F6 Taste
    Private Const VK_F7 = &H76 'F7 Taste
    Private Const VK_F8 = &H77 'F8 Taste
    Private Const VK_F9 = &H78 'F9 Taste
    Private Const VK_F10 = &H79 'F10 Taste
    Private Const VK_F11 = &H7A 'F11 Taste
    Private Const VK_F12 = &H7B 'F12 Taste
    Private Const VK_F13 = &H7C 'F13 Taste
    Private Const VK_F14 = &H7D 'F14 Taste
    Private Const VK_F15 = &H7E 'F15 Taste
    Private Const VK_F16 = &H7F 'F16 Taste
    Private Const VK_F17 = &H80 'F17 Taste
    Private Const VK_F18 = &H81 'F18 Taste
    Private Const VK_F19 = &H82 'F19 Taste
    Private Const VK_F20 = &H83 'F20 Taste
    Private Const VK_F21 = &H84 'F21 Taste
    Private Const VK_F22 = &H85 'F22 Taste
    Private Const VK_F23 = &H86 'F23 Taste
    Private Const VK_F24 = &H87 'F24 Taste
    Private Const VK_NUMLOCK = &H90 'Numlock Taste
    Private Const VK_OEM_SCROLL = &H91 'Scroll Lock
    Private Const VK_LSHIFT = &HA0 'Linke Shift-Taste
    Private Const VK_RSHIFT = &HA1 'Rechte Shift-Taste
    Private Const VK_LCONTROL = &HA2 'Linke STRG-Taste
    Private Const VK_RCONTROL = &HA3 'Rechte STRG-Taste
    Private Const VK_LMENU = &HA4 'Linke ALT-Taste
    Private Const VK_RMENU = &HA5 'Rechte ALT-Taste
    Private Const VK_OEM_1 = &HBA '";"-Taste
    Private Const VK_OEM_PLUS = &HBB '"
    Private Const VK_OEM_COMMA = &HBC '","-Taste
    Private Const VK_OEM_MINUS = &HBD '"-"-Taste
    Private Const VK_OEM_PERIOD = &HBE '"."-taste
    Private Const VK_OEM_2 = &HBF '"/"-Taste
    Private Const VK_OEM_3 = &HC0 '"`"-Taste
    Private Const VK_OEM_4 = &HDB '"["-Taste
    Private Const VK_OEM_5 = &HDC '"\"-Taste
    Private Const VK_OEM_6 = &HDD '"]"-Taste
    Private Const VK_OEM_7 = &HDE '"
    Private Const VK_ICO_F17 = &HE0 'F17 einer Olivette Tastatur (Intern)
    Private Const VK_ICO_F18 = &HE1 'F18 einer Olivette Tastatur (Intern)
    Private Const VK_OEM102 = &HE2 '"<"-Taste oder "|"-Taste einer IBM-Kompatiblen 102 Tastatur (Nicht US)
    Private Const VK_ICO_HELP = &HE3 'Hilfetaste einer Olivetti Tastatur (Intern)
    Private Const VK_ICO_00 = &HE4 '00-Taste einer Olivetti Tastatur (Intern)
    Private Const VK_ICO_CLEAR = &HE6 'Löschen Taste einer Olivetti Tastatur (Intern)
    Private Const VK_OEM_RESET = &HE9 'Reset Taste (Nokia)
    Private Const VK_OEM_JUMP = &HEA 'Springen Taste (Nokia)
    Private Const VK_OEM_PA1 = &HEB 'PA1 Taste (Nokia)
    Private Const VK_OEM_PA2 = &HEC 'PA2 Taste (Nokia)
    Private Const VK_OEM_PA3 = &HED 'PA3 Taste (Nokia)
    Private Const VK_OEM_WSCTRL = &HEE 'WSCTRL Taste (Nokia)
    Private Const VK_OEM_CUSEL = &HEF 'WSCTRL Taste (Nokia)
    Private Const VK_OEM_ATTN = &HF0 'ATTN Taste (Nokia)
    Private Const VK_OEM_FINNISH = &HF1 'Fertig Taste (Nokia)
    Private Const VK_OEM_COPY = &HF2 'Kopieren Taste (Nokia)
    Private Const VK_OEM_AUTO = &HF3 'Auto Taste (Nokia)
    Private Const VK_OEM_ENLW = &HF4 'ENLW Taste (Nokia)
    Private Const VK_OEM_BACKTAB = &HF5 'BackTab Taste (Nokia)
    Private Const VK_ATTN = &HF6 'ATTN-Taste
    Private Const VK_CRSEL = &HF7 'CRSEL-Taste
    Private Const VK_EXSEL = &HF8 'EXSEL-Taste
    Private Const VK_EREOF = &HF9 'EREOF-Taste
    Private Const VK_PLAY = &HFA 'PLAY-Taste
    Private Const VK_ZOOM = &HFB 'ZOOM-Taste
    Private Const VK_NONAME = &HFC 'NONAME-Taste
    Private Const VK_PA1 = &HFD 'PA1-Taste
    Private Const VK_OEM_CLEAR = &HFE 'OEM_CLEAR-Taste
     
    
    
    
    
    Sub neu()
    x = 955
    y = 20
    SetCursorPos x, y
    
    
       'Alt+F4 drücken
       Call keybd_event(1, 0&, 0&, 0&)
     '  Call keybd_event(VK_F4, 0&, 0&, 0&)
       
       'Und wieder loslassen
       Call keybd_event(1, 0&, KEYEVENTF_KEYUP, 0&)
     '  Call keybd_event(VK_F4, KEYEVENTF_KEYUP, 0&, 0&)
    
    
    End Sub
    

      


    Betrifft: AW: Maus klicken von: Michael Scheffler
    Geschrieben am: 26.08.2003 15:37:02

    Hi,

    warum klickst Du uns schließt nicht einfach dei Applikation?

    Gruß

    Micha


      


    Betrifft: AW: Maus klicken von: chris b
    Geschrieben am: 26.08.2003 16:15:21

    Weil ich gerne klicken möchte !
    Wenn das den möglich ist ?
    Würde mich sehr freuen wenn es möglich wäre ??
    Danke Chris


      


    Betrifft: AW: Maus klicken von: Michael Scheffler
    Geschrieben am: 26.08.2003 16:22:58

    Hi,

    versteh ich nicht. Erklär mal.


    Gruß

    Micha


     

    Beiträge aus den Excel-Beispielen zum Thema " Maus klicken"