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

[µo°Ý] ¥Îexcel¥´¶}µ§°O¥»

[attach]booking[/attach]
½Ð°Ñ¦ÒÀÉ®×.ÁÂÁÂ

2011 Shipping NE booking.zip (8.54 KB)

booking

TOP

¦^´_ 21# PJChen
¿é¤J½d³ò¤¤¦³¿ù»~­È  ½Ð­×§ï¦p¤U
  1. For Each E In Rng(1)                          '¨Ì§Ç³B¸Ì½Æ»s½d³òªºÀx¦s®æ
  2.         A.WriteLine (E.Text)                           'Àx¦s®æ¼g¤J¤å¦rÀÉ
  3.     Next
  4.    
½Æ»s¥N½X

TOP

GBKEE,
¤ÓÁÂÁ§A¤F,¥¦¥i¥H¹B§@¥¿±`!¦ý¦³­Ó¤p°ÝÃD·Q½Ð±Ð,²{¦b¸ê®Æ¼g¤Jtxt«á,¥¦·|¦s¦b«ü©wªº¸ô®|,¦ý§Ú­n¦p¦ó¨ÏTXTÀx¦s«á¯à¦Û°Ê¥´¶}?¥i¥H³o»ò°µ¶Ü?

TOP

¦^´_ 23# PJChen
  1. Sub Ex()
  2.     Dim Rng(1 To 2) As Range, Fs As Object, A As Object, E As Range
  3.     Application.ScreenUpdating = False
  4.     With Workbooks("test")                       '½Ð§ï¦¨­n½Æ»s¬¡­¶Ã¯ªº¦WºÙ
  5.         Set Rng(1) = .Sheets("booking").[B3:B35]  'Rng(1) ¤u§@ªí­n½Æ»sªº½d³ò
  6.         Set Rng(2) = .Sheets("booking").[A1]      'Rng(2) ¦sÀɦWºÙªºÀx¦s®æ
  7.     End With
  8.     Set Fs = CreateObject("Scripting.FileSystemObject")        'FileSystemObject ª«¥ó ´£¨Ñ¹ï¹q¸£Àɮרt²Îªº¦s¨ú¡C
  9.     Set A = Fs.CreateTextFile("D:\" & Rng(2) & ".txt", True)   '«Ø¥ß¤å¦rÀÉ®×
  10.     'CreateTextFile ¤èªk «Ø¥ß¤@­Ó«ü©wªºÀɦW¨Ã¥B¶Ç¦^¤@­Ó¥Î©ó¸ÓÀÉ®×Ū¼gªº TextStream ª«¥ó¡C
  11.     '¦pªG¥i³QÂл\¨ä­È¬° True¡A¨ä¬° False ®ÉµLªkÂл\
  12.     For Each E In Rng(1)                          '¨Ì§Ç³B¸Ì½Æ»s½d³òªºÀx¦s®æ
  13.         A.WriteLine (E.Text)                           'Àx¦s®æ¼g¤J¤å¦rÀÉ
  14.     Next
  15.     A.Close
  16.     Workbooks.Open ("D:\" & Rng(2) & ".txt")
  17.     Application.ScreenUpdating = True
  18. End Sub
½Æ»s¥N½X

TOP

GBKEE¤j¤j,
§Ú±Nµ{¦¡­×§ï«á¥i°õ¦æ,¥¦·|¨Ì«ü©w¸ô®|¦s¦¨TXTÀÉ,¦ý·í¥¦¦Û°Ê¥´¶}®É¬°¥t¤@­Ó»PTXT¦PÀɦWªºEXCELÀÉ,ÀÉ®×Ãþ«¬¬°¤å¦rÀÉ!½ÐÀ°§Ú¬Ý¬Ý­þ¸Ì¥X¤F°ÝÃD,§Ú§âÀɮפW¶Ç¤F.TKS. 2011 Shipping NE booking.zip (18.29 KB)

TOP

¦^´_ 25# PJChen
Workbooks.Open ("P:\BCM\Interim\" & Rng(2) & ".txt")
­×§ï¦¨
Shell "Cmd /c start P:\BCM\Interim\" & Rng(2) & ".txt"

TOP

GBKEE,
§¹¥þOK.¯u¬OÁÂÁ§A!

TOP

¦^´_ 26# GBKEE
±z¦n,·Q½Ð°Ý:
¥H¤U¦sÀɪº¦WºÙ§Ú·Q¦A¼W¥[¤@­Ó[A2],¦ý­×§ï«á¥¨¶°«oµLªk°õ¦æ,½ÐÀ°§Ú¬Ý¬Ý»yªk¬O¤£¬O¦³»~?
        Set Rng(2) = .Sheets("Booking").[A1]               'Rng(2) ¦sÀɦWºÙªºÀx¦s®æ
        Set Rng(2) = .Sheets("Booking").[A1] & "_" & [A2]                     '­×§ï«áªº¦sÀɦWºÙ

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-4-22 17:29 ½s¿è

¦^´_ 28# PJChen
§ó¥¿
  1. Sub Try()
  2.     Windows("Shipping for ACE.xlsx").Activate
  3.     Sheets("Booking").Select
  4.     Dim Rng(1 To 2), Fs As Object, A As Object, E As Range
  5.     '­×§ï¦¨ Rng(1 To 2)
  6.     Application.ScreenUpdating = False
  7.     With Workbooks("Shipping for ACE.xlsx")  '½Ð§ï¦¨­n½Æ»s¬¡­¶Ã¯ªº¦WºÙ(¤w¸g¥´¶})
  8.         Set Rng(1) = .Sheets("Booking").[B1:B40]   'Rng(1) ¤u§@ªí­n½Æ»sªº½d³ò
  9.         Set Rng(2) = .Sheets("Booking").[A1]
  10.         Rng(2) = Rng(2) & "_" & Rng(2).Offset(1)
  11.     End With
  12.     Set Fs = CreateObject("Scripting.FileSystemObject")        'FileSystemObject ª«¥ó ´£¨Ñ¹ï¹q¸£Àɮרt²Îªº¦s¨ú¡C
  13.     Set A = Fs.CreateTextFile("P:\TXT\" & Rng(2) & ".txt", True)   '«Ø¥ß¤å¦rÀÉ®×
  14.     For Each E In Rng(1)                          '¨Ì§Ç³B¸Ì½Æ»s½d³òªºÀx¦s®æ
  15.         A.WriteLine (E.Text)                           'Àx¦s®æ¼g¤J¤å¦rÀÉ
  16.     Next
  17.     A.Close
  18.     Shell "Cmd /c start P:\TXT\" & Rng(2) & ".txt"  '¦Û°Ê¥´¶}TXTÀÉ
  19.     Application.ScreenUpdating = True
  20. End Sub
½Æ»s¥N½X

TOP

¦^´_ 29# GBKEE
G¤j,
2­Ó¤èªk§Ú³£¸Õ¤F,¦ýµLªk°õ¦æ,§Ú±NÀɮפW¶Ç,½ÐÀ°§ÚÁ@Á@. TKS.
VBA TEST.zip (37.04 KB)

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤H¤£©È¿ù¡A´N©È¤£§ï¹L¡A§ï¹L¨Ã¤£Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD