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

word vba range °ÝÃD

word vba range °ÝÃD

¥»©«³Ì«á¥Ñ color790 ©ó 2011-7-5 11:43 ½s¿è

½Ð°Ý......¤U­±¬Oword vba³sµ²excel, ÁÂÁ¦U¦ìÀ°¦£~~~

¤U­±¬õ¦âªº³¡¥÷,¸Ó«ç»ò¼g¤~¯à¬O­Órange , ¹³excel¨ººØ range(cells(6,3),cells(10,5))
        xlWk.Sheets(1).Range("c3") = myCell(ActiveDocument.Tables(16).Cell(6, 3))
ªì¾ÇªÌcolor

¦^´_ 1# color790
Ps:WordªºVBA¤£¤Ó¼ô±x
Application.DisplayAlerts = False      Ãö³¬¨t²Îªº¸ß°Ýµøµ¡,¸g§Ú´ú¸Õ   ¦bWord ªº Vba¬O¨S¦³§@¥Î
  1. Sub Excel_Vba()
  2.     Dim xlWkApp As Object, xlWk As Object
  3.     Dim xlWord As Object
  4.     Set xlWkApp = CreateObject("WORD.application")    '±N¥¦­×§ï¬°WORD
  5.     Application.DisplayAlerts = False                 'Ãö³¬¨t²Îªº¸ß°Ýµøµ¡
  6.     With xlWkApp                                      'WORD
  7.         .Visible = True
  8.         Set xlWord = .Documents.Open(Filename:="d:\¸Õºâªí\55.doc") '­×§ï¬°§A­n¶}±ÒdocÀɮתº¥Ø¿ý¦WºÙ
  9.         Set xlWk = Workbooks.Open(Filename:="d:\¸Õºâªí\Book3.xls", Password:="§Aªº±K½X", IgnoreReadOnlyRecommended:=False)
  10.         '¶}±ÒExcel Àɮ׬°°ßŪ¼Ò¦¡   "d:\¸Õºâªí\Book3.xls"->­×§ï¬°§A­n¶}±ÒªºExcelÀÉ ,§Aªº±K½X¤S­×¥¿
  11.         xlWk.Sheets(1).Range("c3") = .ActiveDocument.Tables(16).Cell(6, 3)
  12.         xlWk.Close False       'Ãö³¬Excel ÀÉ®× ¤£¦sÀÉ
  13.     End With
  14.     xlWord.Close True          'Ãö³¬ WordÀÉ®× ¦sÀÉ
  15.     xlWkApp.Quit
  16.     Set xlWkApp = Nothing
  17.     Set xlWk = Nothing
  18.     Set xlWord = Nothing
  19.    
  20. End Sub
  21. Sub Word_Vba()
  22.     Dim xlWkApp As Object, xlWk As Object
  23.     Set xlWkApp = CreateObject("excel.application")
  24.     Application.DisplayAlerts = False                 'Ãö³¬¨t²Îªº¸ß°Ýµøµ¡
  25.     With xlWkApp
  26.         .Visible = True
  27.         Set xlWk = .Workbooks.Open(Filename:="d:\¸Õºâªí\Book3.xls", Password:="1234", IgnoreReadOnlyRecommended:=False)
  28.         xlWk.Sheets(1).Range("c3") = ActiveDocument.Tables(16).Cell(6, 3)
  29.         xlWk.Close False
  30.     End With
  31.     xlWkApp.Quit
  32.     Set xlWkApp = Nothing
  33.     Set xlWk = Nothing
  34. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# color790
  1. Sub nn()
  2. Set DocApp = CreateObject("Word.Application") '³Ð«ØWORD
  3. With DocApp
  4. .DisplayAlerts = wdAlertsNone 'Ãö³¬Äµ§iµ¡
  5. .Visible = True
  6. Set MyDoc = .Documents.Open("E:\TEST.doc")'¶}±ÒWord¤å¥ó
  7. With MyDoc
  8. MsgBox .Tables(1).Cell(1, 1).Range.Text 'Åã¥Ü²Ä¤@­Óªí®æ¤¤²Ä¤@­ÓÀx¦s®æ¤å¦r
  9. .Close 'Ãö³¬ÀÉ®×
  10. End With
  11. .Quit 'Â÷¶}WORD
  12. End With
  13. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 1# color790

ÁÂÁÂ2ª©¥Dªº¦^ÂÐ~~~~
:)
ªì¾ÇªÌcolor

TOP

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD