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

[µo°Ý] macro1 $a$2 ¯f¬r?

[µo°Ý] macro1 $a$2 ¯f¬r?

¦U¦ì¤j¤j,

§Úª¦¤å¬d¤Fmacro1 $a$2,¦ü¥G¤S¬O¤@ºØ¯f¬r,¦ý¸Õ¤F´XºØ¤èªk³£¥u¯à±þ±¼·í­ÓÀɮתº¬r,¨Ï¶}±ÒÀɮ׮ɤ£·|¥X²{´£¥Ü"macro1 $a$2",¦pªG³o­Ó¬r¤]¹³¬O¤§«e§Ú´¿µo°Ý¹Lªº§R°£¥¨¶°ªº¬r,§Ú·Q¥Î¦P¤@¼Ò¦¡,±NÀɮצb¶}±Ò«e¥ý§R°£"macro1 $a$2",¥H¤U¬O¤§«eHsieh¤j¤jÀ°§Ú¼gªº,¥i§_±µµÛ³o­Óµ{¦¡¼g§R°£"macro1 $a$2"ªº¥¨¶°?³o¼Ë§Ú´N¥i¥H¤@¨Ö±N¬rµ¹±þ¤F!
©ÎªÌ¦pªG¤j¤j¦³§ó¦nªº¤èªk,¤]½Ð±Ð±Ð§Ú! ÁÂÁÂ!
    macro2.jpg
  1. Sub Try()
  2. Dim fs
  3. Application.DisplayAlerts = False
  4. fd = ThisWorkbook.Path & "\" & Sheets(1).[E6] 'Àɮץؿý
  5. Set fos = CreateObject("Scripting.FileSystemObject")
  6. Set fdn = fos.getfolder(fd)
  7. Set fc = fdn.Files 'Àɮץؿý¤¤©Ò¦³ÀÉ®×
  8. For Each fs In fc
  9. [A1] = fs.Name '­É¥ÎÀx¦s®æÅã¥Ü¥¿½TÀɦW
  10. With Workbooks.Open(fd & "\" & [A1].Text, 0) ' ¶}±ÒÀɮפ£§ó·s³sµ²
  11. For Each vbc In .VBProject.VBComponents
  12.   Select Case vbc.Type
  13.   Case 100
  14.     .VBProject.VBComponents(vbc.Name).CodeModule.DeleteLines 1, _
  15.     .VBProject.VBComponents(vbc.Name).CodeModule.CountOfLines '§R°£©Ò¦³µ{¦¡½X
  16.   Case Else
  17.     .VBProject.VBComponents.Remove .VBProject.VBComponents.Item(vbc.Name) '²¾°£¼Ò²Õ¡Bªí³æ¡BÃþ§O¼Ò²Õ
  18.   End Select
  19. Next
  20. .Close 1
  21. End With
  22. Next
  23.     Range("A1").Select
  24.     Selection.ClearContents
  25. '¦sÀÉ«áÃö³¬ÀÉ®×
  26. ActiveWorkbook.Save
  27. ActiveWorkbook.Close
  28. End Sub
½Æ»s¥N½X

        ÀR«ä¦Û¦b : ¯¸¦b¥b¸ô¡A¤ñ¨«¨ì¥Ø¼Ð§ó¨¯­W¡C
ªð¦^¦Cªí ¤W¤@¥DÃD