If you want to copy a specific range from a word table to excel.For Example the below code will copy the data from second row of table (ignore first row -- header) and will paste the data into excel.
Sub copy_all_the_data_skip_header()
Dim doc As New Word.Application
Dim abc As Word.Range
doc.Visible = True
' TOOL -> REFRENCE-> MICROSOFT WORD
Documents.Open "C:\Documents and Settings\achamanlalko\Desktop\WORD TABLE.doc"
' it will copy from (row 2 col 1) till (row 7 and col 3) will ignore the first row.
Set abc = doc.ActiveDocument.Range( _
Start:=doc.ActiveDocument.Tables(1).Cell(2, 1).Range.Start, _
End:=doc.ActiveDocument.Tables(1).Cell(7, 3).Range.End)
abc.Select
doc.Selection.Copy
ThisWorkbook.Activate
Sheets(1).Range("a2").Select
ActiveSheet.Paste
doc.Quit
End Sub
Word Document
Excel Macro File
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
If you want to add a new menu on mouse right click "Workbook Navigation showing you the list of all open workbooks and worksheets in ea...
-
Macro to Export Range in Json Format Option Explicit Sub export_in_json_format() Dim fs As Object Dim jsonfile Dim rangetoex...
No comments:
Post a Comment