ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

ª½±µ±q¬Ý½L³nÅé¨ú±oªÑ²¼§Þ³N¤ÀªR¹Ï¸ê®Æ

ª½±µ±q¬Ý½L³nÅé¨ú±oªÑ²¼§Þ³N¤ÀªR¹Ï¸ê®Æ

¥»©«³Ì«á¥Ñ Scott090 ©ó 2019-5-25 13:11 ½s¿è

¤U¹Ï¬O¤¸¤jÂIª÷ÆFªº¹Ï¼Ë¡A¥Î¤â°Ê·íµM¥i¥H¹F¨ì¥Øªº¡G
         
         

           °²¦p­n¸òEXCELª½±µ³sµ²¡A¥ÎVBA¨Ó°µ¦p¤U¡A¬Ý¬Ý¦³¨ä¥L¤ñ¸û¦nªº§@ªk¡C
         1. ¥Î sendkeys "% ": sendkeys "x" ªº¤èªk¤]¥i¥H©ñ¨ì³Ì¤j¡A¦ýµøµ¡ªº¦ì¸m¦b¤£¦Pªº¿Ã¹õªº©w¦ìªí²{¦³¤£¤@¼Ë¡C
         2. ¶×¤Jªºµ²ªGÀɮצì¸m¦b  C:\... \TWEWinner\???.csv¡F ¦³®É¬O ª½±µ¥X²{¦b ¿W¥ßªº Excel.application ªº ¤@­ÓÀÉ®×µøµ¡ (³o¬O¦b¤£¦P¹q¸£°õ¦æªºµ²ªG¡A¦³«Ý¥ý ¶i¸Ñ´b)
'================================================================================================
Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Declare Function GetSystemMetrics Lib "user32.dll" (ByVal index As Long) As Long       'Àò¨úÅã¥Ü¾¹»È¹õ¤j¤p
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long       '²¾°Ê cursor ¨ì«ü©w¦ì¸m
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal Hwnd As Long, lpRECT As RECT) As Long
Private Type RECT
      Left As Long
      Top As Long
      Right As Long
      Bottom As Long
End Type
Dim lpRECT As RECT

Private Declare Function MoveWindow Lib "user32" ( _
      ByVal Hwnd As Long, _
      ByVal x As Long, _
      ByVal y As Long, _
      ByVal nWidth As Long, _
      ByVal nHeight As Long, _
      ByVal bRepaint As Long _
      ) As Long
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)

'¦bÂIª÷ÆF¬Ý¹Ï³nÅé ªº "[6000]§Þ³N½u¹Ï" ÂI«ö Excel¹Ï¥Ü
'¶×¥X ½u¹Ï¸ê®Æ
'===========================================
Sub §Þ³N½u¹Ï¶×¥X_Click()
     
      Dim wb As Workbook
      AppActivate "[6000] §Þ³N½u¹Ï"
      Sleep 1000
      
      µøµ¡³Ì¤j¤Æ

      SetCursorPos 1835, 46  'Excel¹Ï¥Ü ªºÂI«ö¦ì¸m®y¼Ð      
      Sleep (500)
      MouseLeft_Click   'leftClick on he Excel logo
      Sleep (1000)      '½w½Ä®É¶¡¨Ï¸ê®Æ¿é¥X¨ì Excel ¤u§@ªí

      µøµ¡ÁÙ­ì
       Sleep (150)
     
End Sub

    Sub µøµ¡³Ì¤j¤Æ()
       Dim Hwnd&
       Dim x0&, y0&
       x0 = GetSystemMetrics(0)
       y0 = GetSystemMetrics(1)
      Hwnd = FindWindow("TFormPackage", "[6000] §Þ³N½u¹Ï")
      GetWindowRect Hwnd, lpRECT          '«O¯dµøµ¡­ì¨Ó¤j¤p¤Ø¤o
     
      MoveWindow Hwnd, 0, 0, x0, y0, True  '¦Ü¥ª³»¨Ã©ñ¦Ü³Ì¤j
  End Sub


Sub µøµ¡ÁÙ­ì()
       Dim Hwnd&
      Hwnd = FindWindow("TFormPackage", "[6000] §Þ³N½u¹Ï")      
      MoveWindow Hwnd, lpRECT.Left, lpRECT.Top, lpRECT.Right - lpRECT.Left, lpRECT.Bottom - lpRECT.Top, True     'Lefttop and width, height    'Lefttop and width, height
End Sub

Sub MouseLeft_Click() '¼ÒÀÀ«ö·Æ¹«¥ªÁä
      mouse_event 2, 0, 0, 0, 0
      Sleep (200)
      mouse_event 4, 0, 0, 0, 0
      Sleep (150)
End Sub

        ÀR«ä¦Û¦b : ¤H­nª¾ºÖ¡B±¤ºÖ¡B¦A³yºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD