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

[¤À¨É] ¨Ï¥Î¡e©R¥O¦C CMD¡fªº DOS/Dir «ü¥O¨ú¥XÀɮשú²Ó¨ìEXCEL

[¤À¨É] ¨Ï¥Î¡e©R¥O¦C CMD¡fªº DOS/Dir «ü¥O¨ú¥XÀɮשú²Ó¨ìEXCEL

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2015-9-14 15:30 ½s¿è

¨Ï¥Î¡e©R¥O¦C¡DCMD¡fªº DOS / Dir «ü¥O¨ú¥XÀɮשú²Ó¨ìEXCEL¡@

¬Ý¨ì³oÃD¢°¢µ¼Ó¡Dikboy ¤j¤jªººÃ°Ý¡G
[µo°Ý]¦h¼h¸ê®Æ§¨´M§äÀɮתº°ÝÃD
http://forum.twbts.com/viewthrea ... a=pageD1&page=2
¡@

©|¥¼¥h·j´Mºô¤W¬O§_¦³³o­ÓVBA½d¨Ò¡A¥ý°µ­Ó¼ËªO¸Õ¸Õ¡A
¥»¨Ó·Q»¡À³«Ü²³æ¡A°õ¦æ«o®É¥i®É¤£¥i¡A­×­×§ï§ï¦p¤U¡A
­Y¦³§ó¦n­×¥¿ª©¥»¡AÅwªï¤£§[´£¨Ñ¡I¡@

¡Ä¤£¬O±M¦æ¡A¼g°_¨Ó´N¬O¶^¶^¼²¼²¡C
  1. Sub ¨ú¥XÀɮשú²Ó()
  2. Dim UF$, UP$, UT$, xD, FF, TRow, N&, j&, Brr, TT
  3. Call ²M°£
  4. UF = [A1].Value: If UF = "" Then Exit Sub¡@'·j´MÀɮצWºÙ
  5. UP = ThisWorkbook.Path & "\"¡@'·j´M¸ô®|
  6. UT = UP & "UT_File.txt"¡@'Àɮשú²Ó¤å¦rÀÉÀɦW
  7. ¡@
  8. '¡õ­Y¤å¦rÀÉÁÙ¦s¦b¡A§R°£
  9. On Error Resume Next: Kill UT: On Error GoTo 0
  10. '¡õ¥H¡e©R¥O¦C¡fDIR«ü¥O²£¥ÍÀɮשú²Ó¤å¦rÀÉ
  11. Shell "cmd.exe /c dir """ & UP & UF & """ /s /b > " & UT, vbHide
  12. '¡õ¥HDIRÀË´ú¬O§_¥i¥H§ì¨ì¤å¦rÀÉ¡]ÀÉ®×¥i¯à©|¥¼´Nºü¡^
  13. Do Until Dir(UT) <> "": Loop
  14. '¡õÀË´ú¤å¦rÀɬO§_ÁÙ¦b¼g¤J¤¤¡A§_«h¶}±Ò®É¥u¬OªÅ¥Õ¸ê®Æ
  15. Do Until CheckBookOpen(UT) = 0: Loop
  16. ¡@
  17. '¡õ±N¤å¦rÀɤº®e³vµ§¯Ç¤J¡e¦r¨åÀÉ¡f
  18. Set xD = CreateObject("Scripting.Dictionary")
  19. FF = FreeFile
  20. Open UT For Input Access Read As #FF
  21. While Not EOF(1)
  22. ¡@¡@Line Input #FF, TRow
  23. ¡@¡@N = N + 1: xD(N) = TRow
  24. Wend
  25. Close #FF
  26. If N = 0 Then MsgBox "§ä¤£¨ìÀɮסI¡@": Exit Sub
  27. ¡@
  28. '¡õ±N¦r¨åÀɤº®e©î¥X¡eÀɮצWºÙ¡D§¹¾ã¸ô®|¡f¯Ç¤J°}¦C
  29. ReDim Brr(N - 1, 1): N = 0
  30. For Each FF In xD.items
  31. ¡@¡@If FF <> ThisWorkbook.FullName Then
  32. ¡@¡@¡@TT = InStrRev(FF, "\")
  33. ¡@¡@¡@Brr(N, 0) = Mid(FF, TT + 1)
  34. ¡@¡@¡@Brr(N, 1) = FF
  35. ¡@¡@¡@N = N + 1
  36. ¡@¡@End If
  37. Next
  38. ¡@
  39. [A4:B4].Resize(N) = Brr¡@'¶ñ¤J¸ê®Æ
  40. Kill UT¡@'§R¥h¤å¦rÀÉ
  41. End Sub
½Æ»s¥N½X
ªþ¥ó¤U¸ü¡G
20150912a01(DOS-Dir¨úÀɮשú²Ó).rar (13.47 KB)

ª`·N¡G¾¨¶q¤£­n¦b¡e®Ú¥Ø¿ý¡f¤¤°õ¦æ¡A¤]¾¨¶q¤£­n¨Ï¥Î¡e*.*¡f¥h·jÀɮסA¡]¶q¥i¯à¤Ó¤j¡^¡ã¡ã
¡@

¦hÁ­㪩¤jªº­@¤ß¦C¥X§¹¾ã¥N½X¨Ã«ü¥X¥¼´Nºü³´¨À¡A¤Î´£ÂI¨ì¸û°ª¨t²Î·|¹ïC:\ rootºÞ¨î¨Æ¦Ó¡A·Q¨ÓÁÙ¬O¥Î¦^fso¸û¥¿¹D¤F¡C

¨Ó¦Û§Úªº¤p¦Ì¤â¾÷

TOP

¥»©«³Ì«á¥Ñ ¦Ñ®L ©ó 2015-9-12 16:53 ½s¿è

§âÀÉ®×Á`ºÞ·h¤JExcel±±¥ó¤ºª½±µ¨Ï¥Î
¦p¦ó?
//³o¥s°µOLE
MFC  COM
https://msdn.microsoft.com/zh-tw/library/k851ext3.aspx
OLE¾÷¨î

TOP

¥»©«³Ì«á¥Ñ ¦Ñ®L ©ó 2015-9-12 20:00 ½s¿è

·Æ¹«©Ô¤@©ÔÂI¤@ÂI§¹¤uª½±µ¥Î
¼g³DÅ]µ{¦¡½X?
1.gif

TOP

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2015-9-12 20:15 ½s¿è

¦^´_ 4# ¦Ñ®L


ÁÂÁ¤j¤jªº°Ñ»P¡I
¡@
½Ð°Ñ¦Ò¦¹ÃD¡G
¦h¼h¸ê®Æ§¨´M§äÀɮתº°ÝÃD
http://forum.twbts.com/thread-11369-1-1.html

°²³]¦³¤@­ÓÀɮסA¥uª¾¹D¦s¦b¬Y­Ó¡e¸ê®Æ§¨¡f¤¤¡A¦ý¤£ª¾¬O©ñ¦b­þ­Ó¡e¤l¸ê®Æ§¨¡f¡A
¦Ó¡e¤l¸ê®Æ§¨¡f¤¤¤S¦³¡e¤l¸ê®Æ§¨¡f¡A¡e¼h¼Æ¡f¤]¤£½T©w¡A¦p¦ó§Ö³t§ä¨ì³o­ÓÀɮרáe¦Û°Ê¶}±Ò¡f¥¦¡H

¨º©«¤w¦³´X¦ì¤j¤j´£¨Ñ¥¿³W¤S¦³®Äªº¤èªk¡A
¦¹©«¬O¥tÃþ¤èªk¡A¯Â°Ñ¦Ò¡A¨Ã«D³Ì¦n¤è®×¡I

TOP

¦^´_ 1# ­ã´£³¡ªL

§Ú¥Ø«e¨Ï¥Î windows10¨t²Î¡A¥Ø¿ýÀÉ®×Åv­­¦³¨Ç¤£¦P¡AÀÉ®×Á`ºÞ¥i¥H¶}±Ò¤Î¦^¦s¡A¦ý¥Îshell cmd dir ... > file ´N¬O¤£¯à¼g¤JÀÉ®×

¥t¥~¥Ø¿ýÀɮפ£²Å¦Xdos8.3³W«h®É¤]»Ý­n­×§ï
Shell "cmd.exe /c dir " & UP & UF & " /s /b > " & UT, vbHide
§ï¬°
Shell "cmd.exe /c dir """ & UP & UF & " /s /b > """ & UT, vbHide
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 6# ML089


¦³·sª©os ´N¤@ª½¤É¯Å
¨ì©³¯àÀò±o¦óºØ¦n³B?

TOP

¦^´_ 7# yoyobuy

¤u¨ã´N¬O³o¼Ë¡A¦³Âû¤M¥ÎÂû¤M¡A¦³¤û¤M¥Î¤û¤M¡A¥u­n¯à§¹¦¨¥ô°È´N¬O¦n¤M¡C

¦³¨Ç¤Hªº¨t²Î¬Owin98©Îwin10¤£¤@©w¡A¦³¨Ç¤Hªºexcel¬O2003©Î2013¤]¤£¤@©w¡C

½×¾Â´N¬O°Q½×¦UºØ¤èªk¦U¨ú©Ò»Ý¡A¨S¦³¬Æ»ò¬O³Ì¦n©Î¤£¦n¡A²Å¦X¦Û¤vªº»Ý¨D³Ì¦n¡C
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¥»©«³Ì«á¥Ñ ¦Ñ®L ©ó 2015-9-13 07:44 ½s¿è

¦^ÂÐ5¼Ó­ã´£³¡ªL

¶}©l¥\¯àªí¤w¸g´£¨Ñ·j´M¤¶­±
Â\µÛ¤£¥Î»PExcel¦ó¤z
1.gif

TOP

¦^´_ 6# ML089


¼gµ{¦¡´N¬O©È¨Ï¥Îª©¥»¤£¦P¦Óµo¥Í¤£¯à§@¥Î¡A±M·~°ª¤â¥i¥H¥ÎVersion§PÂ_¦Ó°Ï§O»yªk¡A¹ï¥u¦³Âª©¥»ªÌ¡A¦ü¥G´N¸j¤â¡I
¥»¨Ó FileSearch ´N«Ü¦n¥Î¡A¤£ª¾¬°¦ó¦b¸û°ªª©¥»·L³n¤Ï¦Ó¼o±¼¤F¡H
DIR ©Î FSO¡A­n·j¥]§t¡e¤l¸ê®Æ§¨¡fÀɮסA¹ïVBA·s¤â½T¬O¦³Ãø«×¡A¦n¦bºô¤W¤w¦³²³¦h°ª¤â´£¨Ñ²{¦¨»y¥h¥i®M¥Î¡I

¨Ï¥Î cmd ¨ú¥X¡e©Ò¦³Àɮסf©ú²Ó¡A¬O½m¡e¥~¤¦¥\¡f¡A¥i¯à¤Óµw¸Ñ¡I

ÁÂÁª©¥D´£¨Ñ¬Ã¶Qªº°T®§¡I

TOP

        ÀR«ä¦Û¦b : ¬O«D·í±Ð¨|¡AÆg¬ü§@ĵ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD