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

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

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

¦U¦ì«e½ú­Ì¤j®a¦n¡A
ºÃ°Ýµo¥Í¦p¤U¡G
·f°t¤U¹Ï
1.¶}©l¶s¸ò°±¤î¶s³£¦bA.xlsm¸Ì..·s¶}±Ò¤@­Ó¿W¥ßªºexcel¥N½X¦p¤U..¦ý´N¨S¿ìªk¤Þ¥Î¬ÛÃö·sª«¥óexcelªºÄÝ©Ê»P¤èªk

¥N½X­n¦p¦ó¼g¤~¯à¤Þ¥Î±±¨îexcel2.exe©O¡K.

Sub newexcel()
Dim xlapp As Object
Dim xlbook As Object

        Set xlapp = CreateObject("Excel.Application")
       Set xlbook = xlapp.Workbooks.Open("D:\Excel VBA\A.xlsm")

¡¥³oÃä¯à§_CALL  °Æµ{¦¡?      

        xlapp.Workbooks(¡§A¡¨).Close SaveChanges:=False ¡¥
        xlapp.Quit
        
      '  Set xlbook = Nothing
      '  Set xlapp = Nothing
End Sub
ª¦¤å§ä¤F«Ü¤[..¥u§ä¨ì«Ü¦h¹p¦P¤W­±¤@¬q..
ÁٽФj¤j«üÂI¤@¤U¡K.

¥»©«³Ì«á¥Ñ zheng211016 ©ó 2019-3-12 22:53 ½s¿è

²Ä1 : ½Ð§A¥ý¬Ý²M·¡§Aªº°ÝÃD«Ü¦h¥Ù¬Þ¨ì©³¬O­n¦bC.xlsm¹BºâÁÙ¬OB.xlsm?  p.s §Ú¥Îb.xlsm
²Ä2 : ¤j©ó5ªº­È¨Ã¨S¦³5  p.s ¿z¿ï¥²¶·¦³­Ó¼ÐÃD ©Ò¥H§Ú¶K¦bA2°µ¿z¿ï
²Ä3 : µ²ªG­n¶K¨ìA.xlsm ¤u§@ªí1ªº­þ¸Ì? p.s §Ú¶KA.xlsm ªº D1

¤U¹ÏÀɮצì¸m½Ð¦Û¦æ§ó§ï



VBA±±¨îEXCEL.rar (21.49 KB)

TOP

¦^´_ 2# zheng211016

·PÁÂzheng211016¤j¤jªº«ü±Ð:
1.¹Bºâªº½T¬O¦bC.xlsm....¦]¬°¦pªG¬O¦b¦P¤@¼hexcel1.exe¸Ì­±³B²z,³o¤è­±ªºµ{¦¡§Ú³£¼g¦n¤F
  Ãø¦b·s¶}¤@­Óexcel2.exe¸Ì­±³B²z«á¸ê®Æ¦^¶Ç..»Pµ²§ô¶s¦bA.xlsm¸Ì..¬ÛÃöªº¤Þ¥Î»yªk§ÚÆp¬ã¤£¥X¨Ó
2.³oÃä¬O¤p§Ìµ§»~..¦AC.xlsm DÄæ¦h¥´¤@­Ó5...³y¦¨¤j®aªº»~·|¤£¦n·N«ä..
3.³oÃä§Úº|¥´  ..¶K¦bA.xlsm¸Ì­±³£¥i¥H

ps:¦]¬°§Úµ{¦¡½X®¼¦hªº.©Ò¥H³oÃä¬O¤j·§»¡©ú¤@¤U¤è¦V.
ÁٽЦU¦ì«e½ú«üÂI¤@¤U...

TOP

¦^´_ 1# 502243

    °Ñ¦Ò¤@¤U³o¸Ì¤]³\¦³À°§U¡G
    http://forum.twbts.com/viewthrea ... a=pageD1&page=2

TOP

¦^´_ 4# Scott090

·PÁ«e­±¨â¦ì«e½ú«üÂI..
³o½g§Ú¤]¦³ª`·N¨ì....§Ú¥Ø«e³£¬OÆp¬ã³o½g¨ä¤¤±o»yªk..
¨ÓÄ~Äò¼¶¼g...............¥u¬O¹Lµ{¤¤¤@ª½..¥m©N¥m©N.......
µM«áÁÙ¦b§ä¬ÛÃöªº¤åÄm...

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

¦^´_ 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

¦^´_ 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

¥»©«³Ì«á¥Ñ 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

¦^´_ 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

        ÀR«ä¦Û¦b : ¤@­Ó¯Ê¤fªºªM¤l¡A¦pªG´«¤@­Ó¨¤«×¬Ý¥¦¡A¥¦¤´µM¬O¶êªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD