- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# color790
Ps:WordªºVBA¤£¤Ó¼ô±x
Application.DisplayAlerts = False Ãö³¬¨t²Îªº¸ß°Ýµøµ¡,¸g§Ú´ú¸Õ ¦bWord ªº Vba¬O¨S¦³§@¥Î- Sub Excel_Vba()
- Dim xlWkApp As Object, xlWk As Object
- Dim xlWord As Object
- Set xlWkApp = CreateObject("WORD.application") '±N¥¦×§ï¬°WORD
- Application.DisplayAlerts = False 'Ãö³¬¨t²Îªº¸ß°Ýµøµ¡
- With xlWkApp 'WORD
- .Visible = True
- Set xlWord = .Documents.Open(Filename:="d:\¸Õºâªí\55.doc") 'קאּ§An¶}±ÒdocÀɮתº¥Ø¿ý¦WºÙ
- Set xlWk = Workbooks.Open(Filename:="d:\¸Õºâªí\Book3.xls", Password:="§Aªº±K½X", IgnoreReadOnlyRecommended:=False)
- '¶}±ÒExcel Àɮ׬°°ßŪ¼Ò¦¡ "d:\¸Õºâªí\Book3.xls"->קאּ§An¶}±ÒªºExcelÀÉ ,§Aªº±K½X¤S×¥¿
- xlWk.Sheets(1).Range("c3") = .ActiveDocument.Tables(16).Cell(6, 3)
- xlWk.Close False 'Ãö³¬Excel ÀÉ®× ¤£¦sÀÉ
- End With
- xlWord.Close True 'Ãö³¬ WordÀÉ®× ¦sÀÉ
- xlWkApp.Quit
- Set xlWkApp = Nothing
- Set xlWk = Nothing
- Set xlWord = Nothing
-
- End Sub
- Sub Word_Vba()
- Dim xlWkApp As Object, xlWk As Object
- Set xlWkApp = CreateObject("excel.application")
- Application.DisplayAlerts = False 'Ãö³¬¨t²Îªº¸ß°Ýµøµ¡
- With xlWkApp
- .Visible = True
- Set xlWk = .Workbooks.Open(Filename:="d:\¸Õºâªí\Book3.xls", Password:="1234", IgnoreReadOnlyRecommended:=False)
- xlWk.Sheets(1).Range("c3") = ActiveDocument.Tables(16).Cell(6, 3)
- xlWk.Close False
- End With
- xlWkApp.Quit
- Set xlWkApp = Nothing
- Set xlWk = Nothing
- End Sub
½Æ»s¥N½X |
|