- ©«¤l
- 13
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 16
- ÂI¦W
- 0
- §@·~¨t²Î
- WINXP
- ³nÅ骩¥»
- OFFICE2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-8-9
- ³Ì«áµn¿ý
- 2024-9-1
|
[µo°Ý] Ãö©ó§Q¥Îvba±Nexcel¸ê®Æ¶Ç¤Jword
¦U¦ì¦n¡G§Ú¦]¬°¦³»Ýn¡A¤Wºô¬d¤F¦¹¥\¯à
¦ý·íªì¼gªº¥u¦³¤Gµ§¸ê®Ækey(1)' key(2)
¦Ó§Úªº»Ýn¥i¯à¶W¹L10µ§¸ê®Æ»Ýn³z¹Lvba±Nexcel¸ê®Æ¶Ç¤Jword¡A¤£ª¾n¦p¦ó§ó§ï
½Ð«e½ú¯à°÷¨ó§U»¡©ú
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False 'Ãö³¬«Ì¹õ¨ê·s
On Error Resume Next '®·®»¿ù»~
Dim oSt As Range, wdDoc As Word.Document, wdRange As Word.Range
myPath = ThisWorkbook.Path & "\2.doc" '©w¸qword¤å¥ó¸ô®|,¦W¦r¦Û¤vקï,§Ú³]©w¬°2.doc
Set wdDoc = GetObject(myPath) '¥´¶}word
Dim key(2) '©w¸q¤@¤U¼Æ²Õ,
key(1) = "Applicant :" 'n´À´«ªº¼ÆÕu
key(2) = "Assignment No :"
Set wdRange = wdDoc.Content '±Nwordªº¤åÀɤº®e½á¤©wdrange
For i = 1 To 2 '´`Àô
With wdRange.Find
.Text = key(i) '¬d§ä
.Replacement.Text = key(i) + IIf(i = 1, Cells(1, 2).Value, Cells(2, 2).Value) '´À´«
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wdRange.Find.Execute Replace:=wdReplaceAll '¥þ³¡´À´«?
Next
wdDoc.Save '«O¦sword
wdDoc.Close 'Ãö³¬word
Set wdDoc = Nothing
Application.ScreenUpdating = True '¶}±Ò«Ì¹õ¨ê·s
End Sub |
|