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

EXCELÀɮפºªºÀx¦s®æ¤º®e¦p¦ó¼gVBA¶×¥X¦¨TXTÀɮ׮榡??

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¨Ò±Ð¾Ç¶Ü?

¦^´_ 1# poison1
¥ý¿ý»s¥¨¶°¬Ý¬Ý    ¥t¦s·sÀÉ¥i¦s¬°txtÀÉ

TOP

¥»©«³Ì«á¥Ñ 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 !

TOP

¥»©«³Ì«á¥Ñ 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 !

TOP

¬Ý¤£À´= =
¦³§ó²³æªº¼gªk¶Ü?

TOP

¥»©«³Ì«á¥Ñ 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 (©Î§A­nªºªF¦è,¥i¦b¦¹¶}©l¦Û¤v©w¸q§a~)
        Print #1, MYstr
    Next i
Close #1
End Sub

§Æ±æ³o­Ó¨â¨Ò¤l¹ï§AÀ°§U !
NeverTry , NeverNo !

TOP

¦^´_ 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

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD