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

[µo°Ý] ¦p¦ó¨Ï¥ÎVBA¶}±Ò¥t¥~¤@­ÓEXCELÀɮסA¦ý¤£±Ò°Ê¹ï¤è¥¨¶°

[µo°Ý] ¦p¦ó¨Ï¥ÎVBA¶}±Ò¥t¥~¤@­ÓEXCELÀɮסA¦ý¤£±Ò°Ê¹ï¤è¥¨¶°

½Ð°Ý¤@¤U¡A¦]¬°§Ú·Q°µ¤@­Ó ¸ê®Æ¸ü¤J¾¹ªº¥\¯à¡A§Ú¨â­Ó¸ê®Æ§¨³£¦³VBAªºµ{¦¡
§Ú²{¦b·Q¥ÎB¸ê®Æ·íBASE¡A¸ü¤J¦ÜAÀɮפ¤­pºâ
¦ý¦]¬°BÀɮ׶}±Ò®É·|±Ò°Ê¹ï¸Ü¥¨¶°¡A©Ò¥H§Ú¦bAÀɮפ¤³]©w¤FÃö³¬¥¨¶°¡A¨Ó°±¤îBÀɮתº¹ï¸Ü¥¨¶°
¦ý¤]¾É­P§ÚAÀÉ®×¥¨¶°¤]³Q°±¤î¤F¡A§Ú¸Ó¦p¦ó³B²z


ttt.zip (20.5 KB)
Sub test()
    Dim mybook As Workbook
    Dim mysh As Worksheet, dtsh As Worksheet
    Dim cell As Range
    Dim num As Long
    Dim secAutomation As MsoAutomationSecurity
   
    Set mybook = ThisWorkbook
    Set mysh = mybook.ActiveSheet

    mypath = mybook.Path & "\"
    dtfile = Dir(mypath & "*.xls")
    r = 2
    Do Until dtfile = ""
        If dtfile <> mybook.Name Then
            ck = ""
            For Each wb In Workbooks
                If wb.Name = dtfile Then ck = "Y"
            Next wb
  
   secAutomation = Application.AutomationSecurity
   Application.AutomationSecurity = msoAutomationSecurityForceDisable  '------Ãö³¬¥¨¶°

            If ck = "" Then Workbooks.Open mypath & dtfile
   Application.AutomationSecurity = secAutomation  '-----------------¥¨¶°±Ò¥Î
            Set dtsh = Workbooks(dtfile).ActiveSheet

Workbooks(dtfile).Sheets(1).Range("a11:x850").Copy         '½Æ»s B.xls Sheet1ªº a1¨ìc3

Windows(mybook.Name).Activate
Sheets(1).Select
Sheets(1).Range("a11").Activate
ActiveSheet.Paste



                    r = r + 1
                End If
         If dtfile <> mybook.Name Then
            Workbooks(dtfile).Close savechanges:=False
         End If
        dtfile = Dir
    Loop
End Sub

¦^´_ 1# lichang
§Ú¬O³o¼Ë°µªº   °Ñ¦Ò°Ñ¦Ò
dim wb  as workbooks
dim wb1 as workbooks
Set wb = ThisWorkbooks
Application.EnableEvents = False     '¨Ï¥´¶}wb1®É   ¥¨¶°¥¢®Ä
Set wb1 = Workbooks.Open(FileName)
With wb1
             .Sheets(SHname).Cells.Copy wb.Sheets("Temp").Cells(1, 1)
             Application.CutCopyMode = False
             .Close False
End With
Set wb1 = Nothing
Application.EnableEvents = True   '«ì´_¥¨¶°®Ä¤O

TOP

ÁÂÁ±zªº´£¨Ñ¡A§Ú·|´ú¸Õ¬Ý¬Ý!!ÁÂÁÂ!!

TOP

¦^´_ 2# yangjie


    §A¦n¡A§Ú´ú¸Õ¹L±zªº¤è¦¡¡A½T¹ê¥i¥HÁ׶}¥¨¶°¡A«Ü¤£¿ù!!

    ¨º½Ð°Ý¤@¤U¦pªG§Ú¦³dde©ÎRTD ¥~³¡³sµ²¸ê®Æ¡A¦³¿ìªkÁ׶}ª½±µ¤£³sµ²¶Ü??

TOP

¦^´_ 4# lichang
¹ï¤£°_
dde©ÎRTD ¥~³¡³sµ²¸ê®Æ   §Ú¤£±E ¥i½Ð±Ðª©¤j

TOP

¦^´_ 5# yangjie

OK¡A·PÁ±z¼ö¤ß¦^µª¡AÁÂÁÂ!!

TOP

        ÀR«ä¦Û¦b : ¥Ç¿ù¥XÄb®¬¤ß¡A¤~¯à²M²bµL·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD