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

Excel ¿é¥X txt¡A¦h¾lªÅ¥Õ¦æ

Excel ¿é¥X txt¡A¦h¾lªÅ¥Õ¦æ

¤j®a¦n
¥Ø«e­n±N¤u§@³¡ªºÄæ¦ìAªº¼Æ¾Ú¡A¿é¥X¨ì¤å¦rÀÉtxt¤¤¡A¦Aµ¹¨ä¥Lµ{¦¡°õ¦æ¨Ï¥Î
µ{¦¡½X¥D­n¦p¤U¡A¦ý·|¦³­Ó°ÝÃD´N¬O¿é¥X§¹¦¨«áªºtxtÀɮפ¤
¹ê»Ú¤W¥½ºÝ·|¦³¤@­ÓªÅ¥Õ¦æ
³o¾É­P¨ä¥Lµ{¦¡°õ¦æ®É·|¥X¿ù
·Q½Ð°Ý¬O§_¦³¿ìªkÅýexcel¿é¥X®É¡A¥i¥HÁקK¦³³oªÅ¥Õ¦æ
ÁÂÁÂ
  1. torget = folderPath & "javainput.txt"
  2. Open torget For Output As #1

  3.     For i = 1 To filledCellsCount

  4.         outputinfo = Trim(ActiveSheet.Cells(i, 1).Value)
  5.         Print #1, outputinfo
  6.         
  7.         
  8.     Next i

  9. Close #1
½Æ»s¥N½X

¦^´_ 1# yenwang


    Sub test()


Dim fso As Object, filledCellsCount As Integer
Set fso = CreateObject("Scripting.FileSystemObject")
Set target = fso.CreateTextFile("d:\javainput.txt", True)

filledCellsCount = 8

For i = 1 To filledCellsCount - 1
   target.WriteLine Cells(i, 1)
Next
target.Write Cells(filledCellsCount, 1)
target.Close
Set fso = Nothing

End Sub

TOP

¦^´_ 2# quickfixer


¸U¤À·PÁÂ
¦¨¥\¤F:D

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2024-1-11 08:41 ½s¿è

¦^´_ 2# quickfixer


    ÁÂÁ yenwang«e½úµoªí¦¹¥DÃD,ÁÂÁ quickfixer«e½ú«ü¾É
«á¾ÇÂǦ¹©«¾Ç²ß¨ì«Ü¦hª¾ÃÑ,¾Ç²ß¤ß±o¦p¤U:
Excel¤u§@ªí¸ê®Æ:


°õ¦æ«á²£¥Íªº TEXT¤å¦rÀÉ:


Sub TEST()
Dim fso, T$, target
Set fso = CreateObject("Scripting.FileSystemObject")
Set target = fso.CreateTextFile("d:\javainput.txt", True)
For i = 1 To [A65536].End(3).Row:   T = T & vbCrLf & Cells(i, 1):   Next
target.Write Mid(T, 3)
target.Close
Set fso = Nothing
End Sub
https://learn.microsoft.com/zh-t ... eatetextfile-method
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : µêªÅ¦³ºÉ¡D§ÚÄ@µL½a¡AµoÄ@®e©ö¦æÄ@Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD