Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-24-2011, 10:25 AM
pav pav is offline table location, table title Windows Vista table location, table title Office 2007
Novice
table location, table title
 
Join Date: May 2011
Posts: 1
pav is on a distinguished road
Default table location, table title

I have a number of word documents, each contains about 30 tables. My task is to copy all the tables into a spreadsheet (easy), and then to make a list of table titles (don't know how to do). Each document is structured so that table title is a sentence (or a one-sentence paragraph) that immediately precedes the table.


The first part I solve by using
i = ...tables.count
and then copying and pasting each table into a spreadsheet

Any hints on how to find and copy a sentence that precedes each table?
Reply With Quote
  #2  
Old 05-24-2011, 09:10 PM
macropod's Avatar
macropod macropod is offline table location, table title Windows 7 32bit table location, table title Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi pav,

For each table, you could insert a new top row, merge all cells in that row, then copy the preceding sentence into it. For example:
Code:
Dim oTbl As Table, Rng As Range
With ActiveDocument
  For Each oTbl In .Tables
    With oTbl
      Set Rng = .Range.Paragraphs.First.Previous.Range
      Rng.End = Rng.End - 1
      Rng.Cut
      Rng.Characters.Last.Delete
      .Rows.Add BeforeRow:=.Rows.First
      .Rows.First.Cells.Merge
      .Cell(1, 1).Range.Paste
    End With
  Next
End With
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
table location, table title How to have the location (path) of the Word document on the title bar? Jamal NUMAN Word 24 09-06-2017 12:18 PM
table location, table title cell of one table to display in a second table HalinQuincy Word Tables 4 04-03-2011 04:11 PM
table location, table title Help With Table ABB Word Tables 1 12-13-2010 02:46 PM
Pasting table in Photoshop cutting off table azdolfan Word Tables 0 05-16-2010 01:52 PM
table help corkus Word Tables 5 11-18-2009 07:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft