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

½Ð±Ð¦³ÃöEXCELÀx¦s®æ¤º¸ê®Æ³sµ²¦ÜWORD

TO¡GHsieh
·PÁ±zªº¨ó§U¡A¦A¦¸ªºÁÂÁ±z¡I
TO¡G¦Ñ®L
ÁÂÁ±zªº«ü¾É¡A§Ú¤S¦h¾Ç¨ì¤@©Û¤F¡K

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2010-7-9 00:08 ½s¿è

¦^´_ 5# ianlcc
  1. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  2. '½Ð¥ý³]©w¤Þ¥Î¶µ¥ØMicrsoft Word 10.0 ObjectLibrary
  3. Dim Ar()
  4. Dim Wd As Word.Application, Doc As Document
  5. Application.ScreenUpdating = False
  6. Set Wd = CreateObject("Word.Application")
  7. With Sheet2
  8. For i = 1 To .[E65536].End(xlUp).Row
  9.    ReDim Preserve Ar(s)
  10.    Ar(s) = Array(.Cells(i, 5).Value, .Cells(i, 4).Value, .Cells(i, 3).Value)
  11.    s = s + 1
  12. Next
  13. End With
  14. With Wd
  15.    Set Doc = .Documents.Open(ThisWorkbook.Path & "\Ãþ§O.doc") 'docÀɦW¦Û¦æ§ó§ï
  16.    With Doc.Tables(1) '¥²¶·¦s¦bªí®æ
  17.    r = s
  18.    Do Until .Rows.Count <= s
  19.       .Rows(r).Delete
  20.       r = r - 1
  21.    Loop
  22.    
  23.       For i = 0 To UBound(Ar)
  24.       If i = .Rows.Count Then .Rows.Add
  25.          For j = 0 To 2
  26.             .Cell(i + 1, j + 1).Range.Text = Ar(i)(j)
  27.          Next
  28.         Next
  29.    End With
  30. Doc.Save
  31.    .Quit
  32. End With
  33. Application.ScreenUpdating = True
  34. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¨º½Ð±Ð¤@¤U¡A°ÝÃD¤G¤¤¡A§Ú¦pªG­n«ü©wSHEET2ªº¸Ü¡A­n«ç»ò­×§ï©O¡H
·Ð½Ð«ü¾É¤@¤U¡AÁÂÁ±z¡I

TOP

³o¬O·íµMªº£«
¨Ó·½¸ò¥Ø¼Ð³£­n«ü©w²M·¡ªº
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

TO:Hsieh¤j¤j
±z¦n¡AÁÂÁ±zªº«ü¾É¤ÎÀ°¦£¡]¯uªº¬OÀ°¤F¤@­Ó¤j¦£¡A·P®¦¡^
¤£¹L¡A¦A¦V±z½Ð±Ð´X­Ó°ÝÃD¡G
¤@¡B¦pªG§Ú­n«ü©wWORDÀɪºÀɦWªº¸Ü¡A¬O§_¬O¨ì¡u   Set Doc = .Documents.Open(ThisWorkbook.Path & "\Ãþ§O.doc")¡v¡A±N\Ãþ§O.doc­×§ï¦¨¦Û¤v«ü©wªºÀɦW©O¡H
¤G¡B¥t¥~¡A°²³]¦Û¤vªºEXCELÀɸ̦³SHEET1¡BSHEET2¡BSHEET3¡K¦@¦³¤T­Óªº¸Ü¡A»Ý­n¦bVBA¤¤«ü©w§Ú­n³sµ²ªº¬O­þ¤@­ÓSHEET¤ºªº¸ê®Æ¶Ü¡H
¡ô½Ð±Ð³o¨Ç°ÝÃD¡A½Ð¦h¦h«ü±Ð¡AÁÂÁ±z¡I

TOP

¦pªG¥Î³sµ²Àɮפ覡®£©È¹F¤£¨ì¼Ó¥D­n¨D
¸ÑÀ£ÁY¨ì¹q¸£«á°õ¦æexcelÀɮתí®æ­×§ï«á¦sÀÉÃö³¬
¦b¥h¶}±ÒwordÀɬݪí®æ¤º®e¬O§_¸òµÛ§ïÅܤF ExToWd.rar (10.51 KB)
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¬°¦Û¤v§äÂǤfªº¤H¥Ã»·¤£·|¶i¨B¡C
ªð¦^¦Cªí ¤W¤@¥DÃD