score:0
to import from word to excel, try the following.
sub wordtoexcel()
dim wdapp as word.application
dim wddoc as word.document
dim x as integer
dim strfilename as string
dim strfolder as string
dim temp as string
set wdapp = new word.application
'initialise counter
x = 1
'search for first file in directory
strfolder = "c:\test\"
strfilename = dir(strfolder & "*.doc")
'amemd folder name
do while strfilename <> ""
set wddoc = wdapp.documents.open(strfolder & strfilename)
temp = wddoc.tables(1).cell(2, 1).range.text 'read word cell
range("a2").offset(x, 0) = temp
temp = wddoc.tables(1).cell(2, 2).range.text 'read word cell
range("a2").offset(x, 1) = temp
'etc
temp = wddoc.tables(1).cell(2, 3).range.text 'read word cell
range("a2").offset(x, 2) = temp
temp = wddoc.tables(1).cell(2, 4).range.text 'read word cell
range("a2").offset(x, 3) = temp
wddoc.close
x = x + 1
strfilename = dir
loop
wdapp.quit
set wddoc = nothing
set wdapp = nothing
end sub
Source: stackoverflow.com
Related Query
- Import data and text format from word table to excel with excel-vba
- I want to copy all highlighted and shaded text from Word file to Excel along with the colors through VBA
- CSV file import to excel sheet from Web using VBA with exact data format
- Extract a single line of data from numerous text files and import into Excel - with different string lengths
- Import data from Excel to Word - format number with comma
- Open a Word Doc from Excel using VBA to find a Date text and replace it with a date text from a cell in Excel
- Excel VBA - Get data from Pivot Table with 11000+ rows and 53 columns
- Get data from SQL Server with Excel vba and modify some of them then update the table
- VBA Macro - Export table data from Excel file to Word and create a section for each worksheet
- copy and paste data from excel table with 2 colums to excel table with 8 columns using VBA
- Excel Macro - Select all cells with data and format as table
- Find and replace text in Powerpoint 2010 from Excel 2010 with VBA
- Excel VBA Import Word table with merged cells to Excel
- How to export the data from excel to word as text use VBA
- Excel Dynamic Web query specific data from table and transpose the result using VBA code
- Extract a single line of data from numerous text files and import into Excel
- Find and Replace footer text in Word with an Excel VBA Macro
- How to read from a text (.txt) file and place data into an excel 2016 document using VBA Macros editor?
- Import Data from Specific Cells in Word Table to Specific Cells in Excel Workbook start on the first blank row upon each import
- Import Sharepoint 2010 list data from Excel table using VBA
- VBA - Creating Word Document from Excel and Edit Certain Line to Contain Bold Text
- Keep data from cell and text on same printed line in word using vba
- How to import data from Google Sheets into Excel with VBA
- Excel VBA - Get data from Pivot Table using 3 row elements and 1 column element
- How would I use VBA to automatically populate an excel worksheet with data from the pivot table of a separate excel workbook?
- Copy Data from Word to Excel based on Headings and surrounding text
- Import Word File name and data into Excel in a consistent format
- Import a txt file into excel and format with text to column
- Excel VBA macro for consolidating data from multiple sheets based on sheet names with specific text
- How to get content from MS word cells with VBA and clean it for Excel
More Query from same tag
- How to stop Excel window from staying on top when macro is running continuously? Application.screenupdating doesn't work
- Runtime error 3075 missing operator
- Excel VBA: How to dismiss password boxes for linked files in Macro
- Word 2016 Error copying shape to header. Method 'Paste' of object 'Range' failed (80010108)
- Why CanĀ“t I hide the Title bar on a Progress bar?
- Userform will encode data and will create an appointment on Microsoft Outlook Calendar
- Excel UDF - getting VALUE! error and not sure why
- Outlook attachments - Save with Specific Name / Specific type - VBA code
- Excel automation - disable SQL login dialog when refreshing queries
- Linking Data from One sheet into another on DropDown selection
- Excel VBA Script error Subscript out of range (Error 9)
- Deleting Rows From Filtered Range Via Macro
- Rotate line about a point
- SQL QUERY in VBA
- Alternatives to Subtotal function in excel
- Look up values in sheet(x) column(x), match to values in sheet(y) column(y), if they match paste row
- Using both Do While and Loop until in the same time
- How to import a text file without columns and with hard breaks into vba?
- How to create a loop that populates a variable-sized matrix with COUNTIFS?
- sql where clause variable
- Paste as value error 1004
- Filter a column and put value in next column till the end
- How do I clear content in rows based on cell value?
- IF, Else, ElseIF Loop within a certain Date
- VBA to copy all sheets from multiple workbooks
- Importing text file into Excel gets caught on second run of code
- Copying single cell contents and formating to new cell
- Is Microsoft ACE OLEDB 12.0 the right connection string for Microsoft Excel 365?
- How to create a loop to add data series to a chart?
- VBA to copy data from multiple workbooks into master sheet