EXCELÀɮפºªºÀx¦s®æ¤º®e¦p¦ó¼gVBA¶×¥X¦¨TXTÀɮ׮榡??
- ©«¤l
- 2
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 8
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN98
- ³nÅ骩¥»
- OFFICE 2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2011-7-20
- ³Ì«áµn¿ý
- 2011-7-20
|
EXCELÀɮפºªºÀx¦s®æ¤º®e¦p¦ó¼gVBA¶×¥X¦¨TXTÀɮ׮榡??
¨Ò¦pA1Àx¦s®æ~A10Àx¦s®æ¸Ì±¤º®e
¦p¦ó§Q¥ÎVBA¼g¤@Ó¥¨¶°«ö¶s±NA1~A10Àx¦s®æ¤º®e¶×¥X¦¨¤@ÓTXTÀɮשO?
·Ð½ÐEXCEL¹F¤H¤j¤j¥i¥H¼g¥X¤@Ó½d¨Ò±Ð¾Ç¶Ü? |
|
|
|
|
|
|
- ©«¤l
- 47
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 74
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- Macau
- µù¥U®É¶¡
- 2011-6-15
- ³Ì«áµn¿ý
- 2016-7-4
|
¥»©«³Ì«á¥Ñ StanleyVic ©ó 2011-7-20 11:35 ½s¿è
³o¬O§Ú¥®É¬°¤F¤è«K¤u§@¦Ó¼gªº.
¦p¤j¤j̬ݤF.¦³¤£µ½ªº¦a¤è,¤]¦³«Ý¤j¤j̪º«ü¾É..( ¥»¤H¤]@¤ß¨ü±Ð.ÁÂÁÂ^_^)
Private Sub CommandButton1_Click()
Dim AA, BB, CC, DD, EE, FF, GG As String
Dim r As Integer
Open "D:\test\test.txt" For Output As #1 '©w¸qOutput File¦ì¸m
For r = 1 To [A65536].End(xlUp).Row '©w¸q¦æ¤º®e½d³ò
'¦Û¥Ñ³]©w( ¥»¤Hªº¨Ò¤l¬O¨CӮ泣¦³¥¦¦U¦Û³W©wªº¦r²Åªø«×,©Ò¥H´N«Ø¥ß¤F¤½¦¡,¦P®É¤]¬°¤F¤è«K¹ï»ô) :
AA = Cells(r, 1) & Application.WorksheetFunction.Rept(" ", 20 - Len(Cells(r, 1)))
BB = Application.WorksheetFunction.Rept(" ", 3 - Len(Cells(r, 2))) & Cells(r, 2)
CC = Application.WorksheetFunction.Rept(" ", 13 - Len(Cells(r, 3))) & Cells(r, 3) & ".00"
DD = Cells(r, 4) & Application.WorksheetFunction.Rept(" ", 10 - Len(Cells(r, 4)))
EE = Cells(r, 5) & Application.WorksheetFunction.Rept(" ", 8 - Len(Cells(r, 5)))
FF = Cells(r, 6) & Application.WorksheetFunction.Rept(" ", 10 - Len(Cells(r, 6)))
GG = Cells(r, 7) & Application.WorksheetFunction.Rept(" ", 10 - Len(Cells(r, 7)))
mystr = AA & BB & CC & DD & EE & FF & GG
Print #1, mystr
Next r
Close #1
End Sub |
|
NeverTry , NeverNo !
|
|
|
|
|
- ©«¤l
- 47
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 74
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- Macau
- µù¥U®É¶¡
- 2011-6-15
- ³Ì«áµn¿ý
- 2016-7-4
|
¥»©«³Ì«á¥Ñ StanleyVic ©ó 2011-7-20 12:00 ½s¿è
¦^´_ 2# GBKEE
°Ú.????!!!!! ªGµM±j !!! §Ú§Ñ¤F¥i¥H¥Î¿ý!!! Y_Y" ( ª©¥D~~§Ú¤S¾Ç²ß¾Ç²ß¤F...)
Sub Macro1()
ChDir "D:\Test"
ActiveWorkbook.SaveAs Filename:="D:\Test\Macro.txt", FileFormat:=xlText, _
CreateBackup:=False
End Sub
e..µ¥¤@¤U.µ¥¤@¤U..½Ð¬Ý¬Ý¤U¹Ï.
¬°¤°»ò¥X¨ÓªºTXT ¤U±¦³³o»ò¦hªÅ¥Õªº¦a¤è ?
(ps: §ÚªºEXCEL ¤¤ ¤v¸g¬d¬Ý¤F.¥u¦³ÀY10¦æ¦³ªF¦è,¤U±ªº¨S¦³¤º®e!) |
|
NeverTry , NeverNo !
|
|
|
|
|
- ©«¤l
- 2
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 8
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN98
- ³nÅ骩¥»
- OFFICE 2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2011-7-20
- ³Ì«áµn¿ý
- 2011-7-20
|
¬Ý¤£À´= =
¦³§ó²³æªº¼gªk¶Ü? |
|
|
|
|
|
|
- ©«¤l
- 47
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 74
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- Macau
- µù¥U®É¶¡
- 2011-6-15
- ³Ì«áµn¿ý
- 2016-7-4
|
¥»©«³Ì«á¥Ñ StanleyVic ©ó 2011-7-20 14:43 ½s¿è
" GBKEE ~ ª©¥D" ¦b¤W±,¤v¸g»¡¤F¥i¥H¸Õ¤@¤U¥Î ¿ý»s¥¨¶° !
¦pªG¤£©ú¥Õªº¸Ü, §A¤£¤¶·N.¥i¥H¥Î§Ú.è¤~´ú¸Õªº¥N½X
Sub Macro1()
ChDir "D:\Test"
ActiveWorkbook.SaveAs Filename:="D:\Test\Macro.txt", FileFormat:=xlText, _
CreateBackup:=False
End Sub
****************************
¦pªG¼Ó¥D¤£©ú¥Õªº¸Ü.¤]¥i¥H¥Î¥H³o¬q¥N½X. §A·|®e©ö²Ū
Sub XlsToTxT()
Dim MYstr As String, i As Integer '©w¸qÄÝ©Ê
Open "D:\test\test.txt" For Output As #1 '©w¸qOutput File¦ì¸m
For i = 1 To 10 '¥Ñ Row 1to10
MYstr = Cells(i, 1) '¿é¥Xªº¤º®e (©Î§AnªºªF¦è,¥i¦b¦¹¶}©l¦Û¤v©w¸q§a~)
Print #1, MYstr
Next i
Close #1
End Sub
§Æ±æ³oÓ¨â¨Ò¤l¹ï§AÀ°§U ! |
|
NeverTry , NeverNo !
|
|
|
|
|
- ©«¤l
- 125
- ¥DÃD
- 33
- ºëµØ
- 0
- ¿n¤À
- 223
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- Excel 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_¥«
- µù¥U®É¶¡
- 2010-9-6
- ³Ì«áµn¿ý
- 2024-6-8
|
¦^´_ 2# GBKEE
GBKEE¤j¤j
¯à½Ð±Ð
1.¦p¦ó±N excel
Worksheets("¹Ïªí").Range("L16:AE75").Value '¤º®e¸ê®Æ
¶×¥X¦¨ ¸ê®Æ.txtÀÉ
ªþ¤WÀÉ®×
¸ê®ÆÀÉ®× (test.xls)
§Æ±æ¶×¥X txtÀÉ (¸ê®Æ.txt)
test.rar (9.02 KB)
·P¿E¤£ºÉ
2.¥ý¿ý»s¥¨¶°¬Ý¬Ý
ª¦¤å¨S§ä¨ì¡A¯à½Ð±Ð GBKEE¤j¤j
excel ¿ý»sªº®ÉÔ¡A¬Ý¨ì¶×¥X¬O ¦Ç¦âªºµLªkÂI
¸Ó«ç»ò ¿ý»s¡A¤£À´
¯à½Ð±Ð¤@¤U ·P®¦ |
|
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X
|
|
|
|
|