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

[µo°Ý] ¨â­Ó¿W¥ßEXCEL ¦p¦ó±N¹Bºâ§¹ªº¸ê®Æ¦^¶Ç¨ì¥DExcel?

¥»©«³Ì«á¥Ñ GBKEE ©ó 2019-3-14 10:20 ½s¿è

¦^´_ 10# 502243
§A¥u¥Î¹Ï¤ù»¡©ú,¦ý¦p¦A¯à¥[¤W½d¨ÒÀɲ»¥[»¡©ú¤@¤Áª¬ªp,
¦^ÂЪ̷|¶K¤Áªº¦^µª  


§AºÃ´b<===E.Range("d1")  ¬°¦ó¬O¥ÎE?¦Ó¤£¬O¥ÎAp.Workbooks("c").Sheets(1)
Aªº¸ê®Æ ¤£¬O­n¶K¤WC ªºAÄæ ¶Ü?
Set Rng = Ap.Workbooks(1).Sheets(1).Range("A1") '«ü¦WCÀɤU
¿z¿ï[AÄæ]>5 ¨úªº C ªºDÄæ ªº¸ê®Æ  >>¤£´N  E.Range("d1")

§AºÃ´b  If AR <> "" Then '¦³¸ê®Æ    <====AR³Ì¤W­±¤£¬O¤w¸g²MªÅ¬°0¤F??
³o¸Ì°Ú******
For Each E In Rng
        '¤j©ó5 ¼g¤WDÄ檺­È  **¦³
        If E > 5 Then AR = AR & "," & E.Range("d1")
    Next
***********
xApp.App.Quit   ©Î   Ap.Quit      ³£¥i


¦^´_ 14# 502243
¤£¦Pexcel.exe  ¶¡ ªºª«¥ó µLªk¥ÎCopy
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

°²­Y®³Sub Ex_newexce1()¥X¨Ó­×§ï¤@¤U..
¥u¬O³æ¯Âªº½Æ»s¶K¤W

Sub Ex_newexce2()
     Dim AR As Variant, Rng(1 To 2) As Range, E As Range

      With Workbooks("a").Sheets(1)
          Set Rng(1) = .Range(¡§A1¡¨, .Range(¡§A1¡¨).End(xlDown))   ¡¥¦Pexcel.exe ¥i¥H¦¨¥\
          Set Rng(2) = Workbooks(¡§a¡¨).Sheets(1).Range(¡§c1¡¨)       ¡¥AÀÉAÄæcopy AÀÉCÄæ      
           Rng(1).Copy Rng(2)
      End With
   
End Sub


Sub Ex_newexce3()
     Dim AR As Variant, Rng(1 To 2) As Range, E As Range

      With Workbooks("a").Sheets(1)
          Set Rng(1) = .Range(¡§A1¡¨, .Range(¡§A1¡¨).End(xlDown)) ¡¥¤£¦Pexcel.exe  ·|¥¢±Ñ
          Set Rng(2) = Ap.Workbooks(¡§c¡¨).Sheets(1).Range(¡§c1¡¨) ¡¥¡¥AÀÉAÄæcopy CÀÉCÄæ
           Rng(1).Copy Rng(2)
      End With
   
End Sub

¤p§ÌÁÙ¦b«ä¯ÁµÛ¿ù»~ªº­ì¦]....

TOP

¦^´_ 12# zheng211016
®t¦b¦h¤@­Óexcel.exeªºª«¥ó±±¨î..´N³Â·Ð¤FÂI...ºô¸ô¤W±´°Qªº¦n¹³¨Ã¤£¦h
¤]©ÎªÌ¬O§Úªº¬d¸ß®ÉÃöÁä¦r¨S¬d¨ì..
¤£¹LÁÙ¬O·PÁ¦U¦ì«e½úªº«üÂI¨ó§U

TOP

¦^´_ 3# 502243


   ©Ò¥H§ÚªºÀɮצ³¦^µª¨ì§Aªº°ÝÃD?

TOP

¦^´_ 8# Scott090
    ·PÁ«e½úªº¦^À³
Ãþ¦ü¨º¼Ë©I¥s¦ý¤S¤£¤j¤@¼Ë.....®t¦b¸ó¼h©I¥s
²Ä¤@±ø°Ñ¦Ò§Ú¸Õ¹L.¥i¦æ
²Ä¤G±ø§Ú·|¦b¸Õ¬Ý¬Ý

¥Ø«e´ÂApplicationª«¥ó¨º¤è­±¹Á¸Õ..¤]´N¬O.GBKEE¤j¤jµ¹ªº°Ñ¦Ò¤U¥h¬ã¨s

TOP

¦^´_ 9# GBKEE

½Ð±ÐGBKEE¤j¤j:
­è¬Ý¤F´X­Ó¤p®É¦b¤@¦æ¤@¦æ´ú¸Õ..
¦³´X­Ó¦a¤è¤£¤Ó©ú¥Õ
1.
    For Each E In Rng
            '¤j©ó5 ¼g¤WDÄ檺­È
            If E > 5 Then AR = AR & "," & E.Range("d1")      <===E.Range("d1")  ¬°¦ó¬O¥ÎE?¦Ó¤£¬O¥ÎAp.Workbooks("c").Sheets(1)...³o¬q¬Ý¤£¤j©ú¥Õ
        Next
        
        Set Rng = Ap.Workbooks("1").Sheets(1).Range("C:C")   '
        Rng = ""
        If AR <> "" Then '¦³¸ê®Æ    <====AR³Ì¤W­±¤£¬O¤w¸g²MªÅ¬°0¤F??
            AR = Split(Mid(AR, 2), ",")   '¤À³Î      
            Rng(1).Resize(UBound(AR)) = Application.WorksheetFunction.Transpose(AR)
            'BÀÉ-->'¤j©ó5 ¼g¤WDÄ檺­È **¼g¦bAÀÉCÄæ
        End If


2.¶]ªº®É­ÔC.xlsmÀÉ®×AÄ榳½Æ»s¨ì­È..¦ýDÄæÁÙ¬O¤@¼ËªÅªÅªº...¦Ó¥B¤£·|copy¦^A.xlsm ...CÄæ
3.¥t¥~½Ð°ÝGBKEE¤j¤j¦pªG·QÃö³¬·s¶}ªºexcel.exe³o­Óª«¥ó...·í¤UÀ³¸Ó¥Î¬Æ»ò«ü¥O¤~¦æ©O?   xApp.App.Quit     ' Ap.Quit      ' Ap.Close <==³o´X­Ó§Ú¸Õ¦n¹³³£¤£¦æ

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2019-3-13 14:15 ½s¿è

¦^´_ 7# 502243
¸Õ¸Õ¬Ý
  1. '****A.xlsm ¸Ì­±
  2. '**ª«¥óÃþ§O¼Ò²Õ Class1 ªºµ{¦¡½X
  3. Option Explicit
  4. Public WithEvents App  As Application
  5. Property Set T_APP(p As Application)
  6.     Set App = p     'ª«¥óÃþ§O ¾É¤Jª«¥ó
  7.     App.Visible = True
  8. End Property
½Æ»s¥N½X
  1. 'A.xlsm
  2. '¤@¯ë Module1 ªºµ{¦¡½X
  3. Option Explicit
  4. Public xApp As New Class1
  5. Public Ap As Object
  6. Private Sub Ex_¶}©l()
  7.     Set Ap = New Application
  8.     Set xApp.T_APP = Ap
  9.     Ap.Workbooks.Open (ThisWorkbook.Path & "\C.XLSM")
  10.                       '** ½Ð­×¥¿¬°¥¿½TÀɮצWºÙ***
  11. End Sub
  12. Sub Ex_newexcel()
  13.     Dim AR As Variant, Rng As Range, E As Range
  14.     With ThisWorkbook.Sheets(1)  '«ü¦WAÀɤU
  15.         Set Rng = .Range("A1", .Range("A1").End(xlDown))
  16.     End With
  17.     AR = Rng.Value  'AÀɤUªº¼Æ­È
  18.     Set Rng = Ap.Workbooks(1).Sheets(1).Range("A1") '«ü¦WCÀɤU
  19.     Rng.EntireColumn = ""
  20.     Set Rng = Rng.Resize(UBound(AR))
  21.     Rng.Value = AR  'AÀɤUªº¼Æ­È¶K¦bBÀɤW
  22.     AR = ""           'AR ²MªÅ
  23.     For Each E In Rng
  24.         '¤j©ó5 ¼g¤WDÄ檺­È
  25.         If E > 5 Then AR = AR & "," & E.Range("d1")
  26.     Next
  27.     Set Rng = ThisWorkbook.Sheets(1).Range("C:C")   '
  28.     Rng = ""
  29.     If AR <> "" Then
  30.         AR = Split(Mid(AR, 2), ",")
  31.         Rng(1).Resize(UBound(AR)) = Application.WorksheetFunction.Transpose(AR)
  32.         'BÀÉ-->'¤j©ó5 ¼g¤WDÄ檺­È **¼g¦bAÀÉCÄæ
  33.     End If
  34. End Sub

  35. Private Sub Ex_µ²§ô()
  36.     Ap.Workbooks(1).Close False
  37.     xApp.App.Visible = False
  38. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 7# 502243


    ©Ò¥Hª©¥Dªº¶D¨D¬O  A  ±M®×µ{¦¡½X ©I¥s C ±M®×¤ºªº µ{¦¡ ½X?
     ¥i¥H°Ñ¦Ò ¥»½×¾Â¡G
            http://forum.twbts.com/thread-5960-1-1.html
                         ¦p¦ó¥Î¥¨¶°©I¥s¥¨¶°
                         ©I¥s¤£¦P±M®×ªºµ{§Ç   Run "123.XLS!A01.MAIN"

     ©Î¡A¨ä¥Lºô§}
               https://samlifebox.blogspot.com/2015/02/macro-macro.html
                         Excel ¤§ macro ©I¥s macro

       A¡BC ¬O¤£¦PªºExcel.Applicationª«¥ó¡A§ï¤@§ï¤]³\¥i¦æ

TOP

¦^´_ 6# Scott090

­è¦n¬Û¤Ï­C¡K¬ÛÃöªº¬yµ{¹Ï¦p·s¹Ï©Ò¥Ü¡K.

A.xlsm ¸Ì­±ªºµ{¦¡½XÀ³¸Ó¥u·|¦³:
¶}©l¶s
Sub newexcel()
Dim xlapp As Object
        Set xlapp = CreateObject("Excel.Application") '«Ø¥ß¤@­Ó·sªºexcelµ{¦¡
        Set xlbook = xlapp.Workbooks.Open("D:\Excel VBA\c.xlsm") '¥Îexcel¶}±Ò¬¡­¶Ã¯
            xlapp.Visible = True 'excel¥i¥H¬Ý¨£
   '''''''''' '«á­±ÁÙ¦b¼¶¼g¤¤
         
End Sub

µ²§ô¶s
Sub newexcelclose()


C.xlsm¸Ì­±ªºµ{¦¡½X:
±µ¦¬A.xlsm¸Ì­±¸ê®Æ
³B²z¸ê®Æ
¦^¶Ç¸ê®Æ¨ìA

¥u¬O¹Bºâ»P¦^¶Çªºµ{¦¡½Xªº³¡¤À
§ÚÁÙ¦bºc«ä­n¼g¦b­þ­Ó¸Ì­±¤ñ¸û¬¢·í¡K.

TOP

¦^´_ 5# 502243


         ¼á²M½T»{¤@¤U¡G
        Sub newexcel() ³o¤@¬qµ{§Ç½X¬O¼g¦b Excel2Application.C.xlsm
         ¥s¤J Excel1Application.A.xlsm¡AµM«á­n¨ì A.xlsm °õ¦æ¦bA.xlsm ¸Ì­±ªºµ{¦¡½X( ¦p«ö¶s¦b A ¤u§@ªí)¡A
        ¥Î A ªº µ{¦¡½X §â A ªº¸ê®Æ®³¨ì C ¤u§@ªí¥h³B²z¡B³B²z§¹ªº¸ê®Æ®³¦^ A¡C
         ¬yµ{¦^¨ì C.xlsm §â A.xlsm Ãö³¬¡C
         A¡BC  ¬O2­Ó¿W¥ßªºª«¥ó¡C

         ¬O³o¼Ë¶Ü?

TOP

        ÀR«ä¦Û¦b : ­n¤ñ½Ö§ó¨ü½Ö¡D¤£­n¤ñ½Ö§ó©È½Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD