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

excel ¦p¦ó±Nwordªº±±¨î¶µµ²ªGŪ¤J¡A¨Ó¥[¥H²Î­p

excel ¦p¦ó±Nwordªº±±¨î¶µµ²ªGŪ¤J¡A¨Ó¥[¥H²Î­p

¤£¬O¦b¶}±ÒwordÀÉ«á¡A§ä¨ì±±¨î¶µªºTAG¦AŪ¨ú¨ä­È´N¦n¤F¶Ü?(§Úªº±±¨î¶µ¥D­n¬Ocheckbox)
¬Ý¦ü®e©ö¡A¦ý«o¨ì¤£¤F¸Ó±±¨î¶µ(¬O¥Îselection.goto¶Ü?)¡A¤]§ä¤£¨ì¬ÛÃö¸ê®Æ°Ñ¦Ò~³Â·Ð¨ó§U¤@¤U~

¤p§Ì¤w¦³§ä¨ì¸Ñ¨M¤è®×(¦p¤U)¡AÁÂÁ¤j®a¶O¤ß¤F~

Sub getWordItem()     
Application.ScreenUpdating = False
Dim WDAPP As New Word.Application
Dim WDDOC As Word.Document
Dim CCtrl As Word.ContentControl
Dim strFolder As String
Dim WkSht As Worksheet
Dim i As Long, j As Long
strFolder = GetFolder
If strFolder = "" Then Exit Sub
Set WkSht = ActiveSheet
i = WkSht.Cells(WkSht.Rows.Count, 1).End(xlUp).Row
strFile = Dir(strFolder & "\*.docx", vbNormal)
While strFile <> ""
      Set WDDOC = WDAPP.Documents.Open(filename:=strFolder & strFile, AddToRecentFiles:=False, Visible:=True)
     With WDDOC
          For Each CCtrl In .ContentControls
             j=j+1
             WkSht.Cells(i, j) =CCtrl.Checked
          Next
    End With
    WDDOC.Close SaveChanges:=False
    strFile = Dir()
    Wend
WDAPP.Quit
Set WDDOC = Nothing: Set WDAPP = Nothing: Set WkSht = Nothing
Application.ScreenUpdating = True


End Sub
Function GetFolder() As String      '¼È¤£¨Ï¥Î
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function

TOP

        ÀR«ä¦Û¦b : ¤@¥y·Å·xªº¸Ü¡A´N¹³©¹§O¤H¨­¤WÅx­»¤ô¡A¦Û¤v·|ªg¨ì¨â¤Tºw¡C
ªð¦^¦Cªí ¤W¤@¥DÃD