VBA bulk extracts self-scoring in Word tables

Source: Internet
Author: User

There are a wide range of inefficient office practices, such as a yearly self-rating. A breakdown of the scores for the Word document, one item per line, each item to fill in the score items and scores, the team leader after the audit into Excel submitted. The main concern is that a list of scores in a Word document is going to be translated into an Excel line, and if a person copies it, pastes it into Excel, copies it, and then transpose it. A lot of people, looks very troublesome. Then wrote a piece of VBA to handle, here to keep the backup.

  

Sub Rollup Personal Ratings () Dim folderpath$, filename$, filepath$ Dim Wdapp As Object Dim Doc As Object Dim Tbl As Object    Dim Index&, Irow&, icol& cells.clearcontents Set wdapp = CreateObject ("Word.Application") FolderPath = Thisworkbook.path & "\" FileName = Dir (FolderPath & "*.doc*") IRow = 0 Do While Filenam E <> "" IRow = iRow + 1 FilePath = folderpath & FileName Set Doc = WdApp.documents.Open (Fil Epath) Set TBL = doc.tables (1) Cells (IRow, 1). Value = Withnosymbol (TB. Cell (1, 2). Range.Text) Icol = 1 for index = 3 to icol = icol + 1 Cells (IRow, Icol). Value = Withnosymbol (TB. Cell (Index, 5). Range.Text) Next Index icol = icol + 1 ' Cells (IRow, Icol). Value = Withnosymbol (TB. Cell (27, 9). Range.Text) Doc.close FileName = Dir Loop wdapp.quit Set wdapp = Nothing End subfunction Withnos Ymbol (ByVal OrGstr As String) As String Withnosymbol = Left (Orgstr, Len (ORGSTR)-2) ' Remove Word document cell after adding two symbols end Function 

  

VBA bulk extracts self-scoring in Word tables

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.