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

[µo°Ý] ¦p¦ó¥ÎVBA¾ã²z¸ê®Æ

[µo°Ý] ¦p¦ó¥ÎVBA¾ã²z¸ê®Æ

¥»©«³Ì«á¥Ñ play9091 ©ó 2012-4-15 14:33 ½s¿è

³Ìªñ¦b·Q¦³¨S¦³¤°»ò¤è¥i¥H¹F¨ì¥ÎVBA¨Ó¾ã²z¤å¦rÀÉ¡K¡K

¹ê»Ú¤Wªº°µªk¡A¨ú¥N©Ò¦³ªº´«¦æ²Å¸¹¡C
µM«á§â "END+++" ¥Î "END^p+++" ¨ú¥N¡C

­ì¥»§Ú¬O¥Îword¨Ó°µ¤W­±ªº¨Æ¡A¦ý¦]¬°ÁÙ­n¶×¤Jexcel°µ¾ã²z¡A©Ò¥H·Q»¡¯à¤£¯à¥Îexcel¹F¨ì¡C
ÁÙ¬O»¡¦³¥i¥H°õ¦æ¥~³¡µ{¦¡ªº¥\¯à¡H¡H

®ÄªG¦p¥I¥ó¡I¡I¡I

203.rar (8.11 KB)

ªì¾ÇVBA¥E¨ìtwbts

¦^´_ 1# play9091

¬d¬Ý¤@¤UFSO(FILE SYSTEM OBJECT)À³¥Î
  1. Sub ReadStrangeFile()
  2.      Dim FSO As Object 'FileSystemObject
  3.     Dim FSOFile As Object 'File
  4.     Dim FSOStream As Object 'TextStream
  5.     Dim FSOStreamWrite As Object 'TextStream
  6.     Dim strFileName As String
  7.     Dim strFileNameNew As String
  8.     Dim strCurrLine As String
  9.    
  10.     Set FSO = CreateObject("Scripting.FileSystemObject") 'FileSystemObject
  11.    
  12.     strFileName = "C:\blog\tw\txt\203-¾ã²z«e.txt"
  13.     Set FSOFile = FSO.GetFile(strFileName)
  14.     Set FSOStream = FSOFile.OpenAsTextStream(1, -2) 'ForReading, TristateUseDefault
  15.    
  16.     strFileNameNew = "C:\blog\tw\txt\203-¾ã²z«á.txt"
  17.     Set FSOStreamWrite = FSO.OpenTextFile(strFileNameNew, 2, True) 'ForWriting

  18.     strCurrLine = ""
  19.     Do While Not FSOStream.AtEndOfStream
  20.         strCurrLine = strCurrLine & FSOStream.ReadLine
  21.         If Right(Trim(strCurrLine), 3) = "END" Then
  22.             FSOStreamWrite.WriteLine (strCurrLine)
  23.             strCurrLine = ""
  24.         End If
  25.     Loop
  26.     FSOStream.Close
  27.     FSOStreamWrite.Close
  28. End Sub
½Æ»s¥N½X
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¦^´_ 2# kimbal


    «z³á¡I¡I¡I
³o¤èªk¤Ó¯«¤F¡AÁÙ¨S¦³¥Î¹LFSO©O¡K¡K¨ÓºCºC¬Ý¾Ç²ß¡K¡K¦³¤£À´ªº¦A¤W¨Ó°Ý¡I¡I¡I
ªì¾ÇVBA¥E¨ìtwbts

TOP

        ÀR«ä¦Û¦b : §g¤l¥ß«í§Ó¡A¤p¤H«í¥ß§Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD