- ©«¤l
- 47
- ¥DÃD
- 19
- ºëµØ
- 0
- ¿n¤À
- 82
- ÂI¦W
- 0
- §@·~¨t²Î
- win
- ³nÅ骩¥»
- xp
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2014-7-4
- ³Ì«áµn¿ý
- 2021-9-4
|
¤j®a¦n
§Ú§ä¨ì¤§«eª©¥D¦^ÂЪº¸ê®Æ
http://forum.twbts.com/thread-4838-1-1.html
¦ý¬Oª½±µ§Q¥Î¤Wzªºµ{¦¡,·|¥X²{¤@¨Ç°ÝÃD
¥Ñ©ó§Úªºexcelªí¤¤¬O§Q¥Î¨ç¼Æªº¤è¦¡¡A±Nword©Ò¶K¶i¥hªº¸ê®Æ¶i¦æ¬d§ä
¦Ó,ª½±µ§Q¥Î¤Wzµ{¦¡,·|¥X²{¶K¤Jªº¦r¦êµLªk§Q¥Îexcel¤¤ªº¨ç¼Æ¶i¦æ¬d§äªº°ÝÃD(¸Ô²Óªºì¦],§Ú¤]¤£²M·¡
¦]¦¹,¥H¤U§Ú°w¹ï¤Wz°ÝÃD¶i¦æ§ï¨}«áªºµ{¦¡(¦bword2003¡B2010¤Îexcel2003¡B2010¬Ò´ú¸Õ¥i¥Î- Sub test()
- [code]Sub test()
- Dim xlWkApp As Object, xlWk As Object
- Dim b, i, q As Integer
- Dim strSrcName As String
- i = 1
- Set xlWkApp = CreateObject("excel.application") 'À³¥Îexcel
- With xlWkApp
- .Visible = False 'Åýexcelªº°õ¦æ¤£¥i¨£
- Set xlWk = .Workbooks.Open("excel½d¥»ªº¸m©ñ¸ô®|") '¶}±Òexcel½d¥»
- While i <= ActiveDocument.Tables(1).Rows.Count '³]©wiªº´`Àô¬°word¤¤ªº²Ä¤@Óªí®æªºÁ`¦C¼Æ
- b = ThisDocument.Tables(1).Cell(i, 1) 'Â^¨úword¤¤ªºtable1¤¤ªºcell(i,1)
- b = Left(b, Len(b) - 2) '¿ï¨úwordªí®æ¤¤ªº¦r¦ê
- xlWk.Sheets("sheet¦WºÙ").Range("c" & i + 4) = b '±Nwordªí®æ¤¤ªº¦r¦ê,¶K¨ìexcel¤¤ªºcÄ椤
- ThisDocument.Tables(1).Cell(i, 2).Range.Text = xlWk.Sheets("sheet¦WºÙ").Range("d" & i + 4) '±NexcelªºdÄ椤ªºÈ¶K¦^word¤¤ªº²Ä¤GÄæ
- ThisDocument.Tables(1).Cell(i, 3).Range.Text = xlWk.Sheets("sheet¦WºÙ").Range("e" & i + 4) '±NexcelªºeÄ椤ªºÈ¶K¦^word¤¤ªº²Ä¤TÄæ
- i = i + 1
- Wend
- End With
- End Sub
½Æ»s¥N½X |
|