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

CSVÀx¦s°ÝÃD(¤w¸Ñ¨M)

CSVÀx¦s°ÝÃD(¤w¸Ñ¨M)

¥»©«³Ì«á¥Ñ koala2099 ©ó 2012-5-6 21:14 ½s¿è

¦Û»{µ{¦¡§Ú§¹¥þ¤£¸Ñ
©Ò¥H~§Æ±æ¦³¤HÄ@·NÀ°À°§Ú
¨C¤ë¤£©w´Á¦³.csvÀɮ׸ê®Æ¶i¨Ó»Ý¾ã²z(ªñ30­Ó)
¥Ø«e§@ªk¬O¤@­Ó¤@­Ó¶}±Ò¦A°µ¥tÀx¦s¦¨.xls¬Û·í¶O®É
½Ð¨D¦³¤j¤j¨ó§U¬O§_¥i¨Ï¥ÎVBA
±Ncsvdb¸ê®Æ§¨¤ºªº.csvÀx¦s¦¨.xls
¥t¦s«á¦s©ñ¦ì¸m¤£ÅÜÀɦW¤£ÅÜ
01.csv¡÷01.xls
03.csv¡÷03.xls
04.csv¡÷04.xls
.....
³Ì«ácsvdb¸ê®Æ¨Ó¤ºªºÀÉ®×·|¦³.csvÀɤÎ.xlsÀÉ2ºØ
«ô°U¤F~

CSVdb.zip (3.67 KB)

¦^´_ 1# koala2099
Excel  ¬O¥i¥Hª½±µ¶}±Ò CSV ÀÉ®× ¤£¤@©w­n¥t¦s¬° XLS
  1. Option Explicit
  2. Sub Ex()
  3.     Dim xlpath As String, xlfile As String
  4.     xlpath = "D:\csvdb\"
  5.     xlfile = Dir(xlpath & "*.csv")
  6.     'Dir ¨ç¼Æ ¶Ç¦^¤@­Ó String ¡A¥Î¥Hªí¥Ü¦X¥G±ø¥ó¡BÀÉ®×ÄÝ©Ê¡BºÏºÐ¼Ð°Oªº¤@­ÓÀɮצWºÙ¡B©Î¥Ø¿ý¡BÀɮק¨¦WºÙ¡C
  7.     'Dir ·|¶Ç¦^²Ä¤@­Ó²Å¦X pathname ªºÀɮצWºÙ¡A­Y­n¨ú±o¨ä¥¦²Å¦X pathname ªºÀɮצWºÙ¡A½Ð­«·s©I¥s Dir¡A¥B¤£­n¨Ï¥Î¤Þ¼Æ¡A¦pªG¤w¨S¦³¦X¥G±ø¥óªºÀɮסA«h Dir ·|¶Ç¦^¤@­ÓªÅ¦r¦ê ("")¡A¤@¥¹¶Ç¦^­È¬°ªÅ¦r¦ê®É¡A¦p­n¦A¦¸©I¥s Dir ¡A¤]¥²¶·­n¦A«ü©w pathname ¡A§_«h·|²£¥Í¿ù»~
  8.     Do While xlfile <> ""
  9.         With Workbooks.Open(xlpath & xlfile)
  10.             .SaveAs Filename:=xlpath & Replace(xlfile, "csv", ".xls")
  11.             .Close SaveChanges:=True   'Ãö³¬ ÀÉ®× ,¦sÀÉ
  12.          End With
  13.         xlfile = Dir
  14.     Loop
  15. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# GBKEE
¥þ³¡¸ê®Æ³£¦s¦bAÄæ¤W¡G
A1 -> ·~°È­û,1¤ë,2¤ë,3¤ë,Á`·~ÁZ
A2 -> ¤ý¤j¤ì,678,15,150,843
A3 -> ±i¤p¤ò,51,99,47,197
A4 -> §õ¤p½÷,343,8,50,401
A5 -> ¤E¤sªL,80,46,505,631
A6 -> ¾G¤¤¤ß,480,65,396,941
A7 -> ¤ý¤¤¤ì,996,33,49,"1,078"
A8 -> ³\¤j¤s,764,944,994,"2,702"
A9 -> ±i¤pª÷,503,96,9,608

TOP

¥»©«³Ì«á¥Ñ koala2099 ©ó 2012-5-6 15:15 ½s¿è

¦^´_ 2# GBKEE


CSV ÀÉ®×¥iª½±µ¶}±Ò§Ú¤F¸Ñ
¦]¬°³s±µaccess°õ¦æ»Ý¨Ï¥Î.xls¤£¤[«e¸ê®Æ¥þ­±§ïcsv
¸I¤W«e½úÂ÷¾
¥Ø«e«Ý¥L¤H­×§ïaccess³s±µ«e¨C¤Ñ¥u¦n¤@­Ó¤@­Ó¥t¦s¬°xls
¥ý¸Ñ¨M¥Ø«eªº§xÃø....
±zµ¹ªº¸ê®Æ¥i¥H¨Ï¥Î¦ý¦ì¸m¥þ²¾¦ì¤F
¥i¥H~Åý¥¦¦ì¸m¤£ÅܶÜ?
·PÁ¤j¤j±zªºÀ°¦£
Åý§Ú¦b¤u§@¤W¥i¥H¬Ù¤U³\¦h®É¶¡
±zªº¸ÑÄÀ¤Î¸ê®Æ¤º®e·|¸Ô¥[¤F¸Ñ
«D±`·PÁ±z~·P®¦^^

TOP

¦^´_ 3# c_c_lai
¦^´_ 4# koala2099
º|¤F¤@­Ó°Ñ¼Æ  FileFormat:=xlNormal
  1. Option Explicit
  2. Sub Ex()
  3.     Dim xlpath As String, xlfile As String
  4.     xlpath = "D:\csvdb\"
  5.     xlfile = Dir(xlpath & "*.csv")
  6.     'Dir ¨ç¼Æ ¶Ç¦^¤@­Ó String ¡A¥Î¥Hªí¥Ü¦X¥G±ø¥ó¡BÀÉ®×ÄÝ©Ê¡BºÏºÐ¼Ð°Oªº¤@­ÓÀɮצWºÙ¡B©Î¥Ø¿ý¡BÀɮק¨¦WºÙ¡C
  7.     'Dir ·|¶Ç¦^²Ä¤@­Ó²Å¦X pathname ªºÀɮצWºÙ¡A­Y­n¨ú±o¨ä¥¦²Å¦X pathname ªºÀɮצWºÙ¡A½Ð­«·s©I¥s Dir¡A¥B¤£­n¨Ï¥Î¤Þ¼Æ¡A¦pªG¤w¨S¦³¦X¥G±ø¥óªºÀɮסA«h Dir ·|¶Ç¦^¤@­ÓªÅ¦r¦ê ("")¡A¤@¥¹¶Ç¦^­È¬°ªÅ¦r¦ê®É¡A¦p­n¦A¦¸©I¥s Dir ¡A¤]¥²¶·­n¦A«ü©w pathname ¡A§_«h·|²£¥Í¿ù»~
  8.     Do While xlfile <> ""
  9.         With Workbooks.Open(xlpath & xlfile)
  10.             .SaveAs Filename:=xlpath & Replace(xlfile, "csv", ".xls"), FileFormat:=xlNormal
  11.             .Close SaveChanges:=True   'Ãö³¬ ÀÉ®× ,¦sÀÉ
  12.          End With
  13.         xlfile = Dir
  14.     Loop
  15. End Sub
½Æ»s¥N½X

TOP

¦^´_ 5# GBKEE


    :'( §¹¥þ²Å¦X»Ý¨D^^«D±`ÁÂÁ§AªºÀ°¦£

TOP

        ÀR«ä¦Û¦b : ÀR§¤±`®¦¤v¹L¡B¶¢½Í²ö½×¤H«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD