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

wordªí®æ¶K¨ìexcel¤¤

wordªí®æ¶K¨ìexcel¤¤

¤j®a¦n
§Ú·Q°Ý¤@¤U¦p¦ó¦bword Àô¹Ò¤U
¶}±Òexcel µM«á±Nwordªºªí®æ¶K¨ìexcelªºsheet1¤¤ªºc5¤¤
µM«á¦A±Nd5¡Be5¤¤ªº¤º®e¶K¦^word¤¤

¦b³Â·Ð¤j®a¤F

ÁÂÁ¤j®a~

¤j®a¦n
§Ú§ä¨ì¤§«eª©¥D¦^ÂЪº¸ê®Æ
http://forum.twbts.com/thread-4838-1-1.html
¦ý¬Oª½±µ§Q¥Î¤W­zªºµ{¦¡,·|¥X²{¤@¨Ç°ÝÃD
¥Ñ©ó§Úªºexcelªí¤¤¬O§Q¥Î¨ç¼Æªº¤è¦¡¡A±Nword©Ò¶K¶i¥hªº¸ê®Æ¶i¦æ¬d§ä
¦Ó,ª½±µ§Q¥Î¤W­zµ{¦¡,·|¥X²{¶K¤Jªº¦r¦êµLªk§Q¥Îexcel¤¤ªº¨ç¼Æ¶i¦æ¬d§äªº°ÝÃD(¸Ô²Óªº­ì¦],§Ú¤]¤£²M·¡

¦]¦¹,¥H¤U§Ú°w¹ï¤W­z°ÝÃD¶i¦æ§ï¨}«áªºµ{¦¡(¦bword2003¡B2010¤Îexcel2003¡B2010¬Ò´ú¸Õ¥i¥Î
  1. Sub test()
  2. [code]Sub test()
  3. Dim xlWkApp As Object, xlWk As Object
  4. Dim b, i, q As Integer
  5. Dim strSrcName As String
  6. i = 1
  7. Set xlWkApp = CreateObject("excel.application") 'À³¥Îexcel
  8. With xlWkApp
  9. .Visible = False 'Åýexcelªº°õ¦æ¤£¥i¨£
  10. Set xlWk = .Workbooks.Open("excel½d¥»ªº¸m©ñ¸ô®|") '¶}±Òexcel½d¥»
  11. While i <= ActiveDocument.Tables(1).Rows.Count '³]©wiªº´`Àô¬°word¤¤ªº²Ä¤@­Óªí®æªºÁ`¦C¼Æ
  12. b = ThisDocument.Tables(1).Cell(i, 1) 'Â^¨úword¤¤ªºtable1¤¤ªºcell(i,1)
  13. b = Left(b, Len(b) - 2) '¿ï¨úwordªí®æ¤¤ªº¦r¦ê
  14. xlWk.Sheets("sheet¦WºÙ").Range("c" & i + 4) = b '±Nwordªí®æ¤¤ªº¦r¦ê,¶K¨ìexcel¤¤ªºcÄ椤
  15. ThisDocument.Tables(1).Cell(i, 2).Range.Text = xlWk.Sheets("sheet¦WºÙ").Range("d" & i + 4) '±NexcelªºdÄ椤ªº­È¶K¦^word¤¤ªº²Ä¤GÄæ
  16. ThisDocument.Tables(1).Cell(i, 3).Range.Text = xlWk.Sheets("sheet¦WºÙ").Range("e" & i + 4) '±NexcelªºeÄ椤ªº­È¶K¦^word¤¤ªº²Ä¤TÄæ
  17. i = i + 1
  18. Wend
  19. End With
  20. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD