- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 7# pesi2884 - Sub Ex()
- Dim Fs As Object
- Dim Sh As Worksheet, FileName As String, i%
- For Each Sh In Sheets
- FileName = "D:\" '«Ø¥ßÀɮ׸ê®Æ§¨"
- Set Fs = CreateObject("Scripting.FileSystemObject").OpenTextFile(FileName & Sh.Name & ".txt", 8, True, -1)
- 'FileSystemObjectª«¥ó,´£¨Ñ¹ï¹q¸£Àɮרt²Îªº¦s¨ú¡C OpenTextFile ¶}±ÒÀÉ®×.
- '8 -> ForAppending: ¶}±Ò¤@ÓÀɮרüg¿é¥X¦ÜÀɮתº§À³¡¡C1 -> ForReading:¶}±Ò¤@Ó°ßŪÀɮסCµLªk¹ï¦¹Àɮ׶i¦æ¼g¤J¡C
- 'True: ¥¦ªí¥Ü¦pªG«ü©wªº filename ¤£¦s¦b¬O§_¥i¥H«Ø¥ß¤@Ó¶}·sÀɮסC¦pªG«Ø¥ß¶}·sÀɮסA¨äȬ° True¡CY¤£«Ø¥ßÀɮרäȬ° False¡C¹w³]Ȭ° False¡C
- '-1 ¥H Unicode ®æ¦¡¶}±ÒÀɮסC¦pªG¬Ù²¤¡A«hÀÉ®×¥H ASCII ®æ¦¡¶}±Ò¡C
-
- 'Set Fs = CreateObject("Scripting.FileSystemObject").CreateTextFile(FileName & Sh.Name & ".txt", True, True)
- 'CreateTextFile ·s«ØÀÉ®×,
- '²Ä1Ó True: ªí¥Ü¤@Ó¤w¦s¦bÀɮ׬O§_¥i³QÂл\¡C¦pªG¥i³QÂл\¨äȬ° True¡A¨ä¬° False ®ÉµLªkÂл\,¹w³]Ȭ°False.
- '²Ä2Ó True: ¡C¦pªG§@¬°¤@Ó Unicode Àɮ׫إߡA¨ä¬° True¡A§@¬°¤@Ó ASCII Àɮ׫إߡA¨ä¬° False¡C¹w³]Ȭ°False
- i = 1
- Do While Sh.Cells(i, "A") <> ""
- Fs.Write Sh.Cells(i, "A") '±N¦r¦ê¼g¤J©³ºÝ¡C"
- Fs.WriteLine '´«¦æ
- i = i + 1
- Loop
- Fs.Close ' ±NÀÉ®×Ãö³¬¡C
- Next
- End Sub
½Æ»s¥N½X |
|